Post Counters

Molongui » Help » Molongui Authorship Docs » FAQs » Post Counters

Molongui Authorship keeps track of the number of entries an author has written. Each time a post is added, edited or trashed counters are automatically updated for the involved post and authors.

However, when activating the plugin or changing post type configuration, post counters need to be initiated/updated globally. Depending on the number of posts and authors you have in your site, that is a process that might take a while. So the plugin runs it as a background task. And when it is running you will see a notice on your Dashboard like the one below:

The notice will be displayed on your Dashboard on every page load. Doesn’t matter if you dismissed it in the past.

Only once the process has finished, the notice will go away. Then you will get notified with another notice that will be displayed only once:

Wrong Count Displayed

Post counters are initiated when the plugin is activated. And that is a process that is run in the background. But it can only be run if the WP Cron is enabled. By default it is on all installations, but you might have disabled it.

So, if your post count values are wrong:

  1. Make sure WP Cron is enabled and able to run normally
  2. Go to Authors > Tools > Authorship
  3. Locate the “Update Post Counters” option and click on the Run button

Once post counters are updated, you may disable WP Cron again, although it is not advised.

What if I have the WP Cron disabled

If for any reason you have the WP Cron disbaled, the background task responsible to get the post counters updated won’t be run.

Some hosting providers disable the WP Cron for performance reasons. In order to enable background tasks to be executed, they replace the default WP Cron with a server-side cron that ends up running the wp-cron.php.

In such cases, there is a quick workaround for you to get the post counters update process run. You just need to add the PHP snippet below to your site (either to your child theme’s functions.php file or wherever you think best):

add_filter( 'authorship/check_wp_cron', '__return_false' );

Once you have it in place, deactivate the plugin and reactivate it again. The two background tasks responsible for adding/updating the required metadata should be run now.

If it was you who disbaled the WP Cron and you didn’t replace it with a system cron, then you will need to temporally enable it so the counters get updated. Once they are up to date, you can disable it again. So you can do this:

  1. Enable the WP Cron by undoing what you did to disable it
  2. Deactivate the plugin
  3. Reactivate the plugin
  4. Wait until the process completes
  5. Optionally, disable the WP Cron again

Data Updater Notice Doesn’t Go Away

Updating post counters is a process that usually takes only a few seconds/minutes to complete. So the notice letting you know the background task is running should go away in a short while.

However, and as stated above, it might take a long while. Even days. Why that much? Well, in order to prevent timeouts on sites with thousands of posts and authors, the update process is split into smaller chunks that are processed on low priority.

So, if your site has a lot of posts and authors, don’t worry if the notice doesn’t go right away.

What if your site doesn’t have that many posts nor authors and the notice is still there? Well, chances are that, while the task was running in the background, you, somehow, disabled the WP Cron or introduced some server configuration change that is preventing the WP Cron to run normally. So please make sure WP Cron is enabled and able to run normally.

Having WP Cron disabled will prevent the background process to run so post counters might display wrong values.

Please note that web server configuration might also be preventing the WP Cron to run. Even if you have it enabled! For instance, control access using HTTP Basic authentication kills WP Cron. In that case, the easiest solution is to install a plugin —like WP Cron HTTP Auth— that allows WP Cron to get around the password protection.

Updated on February 14, 2024

Did not find a solution? We are here to help you succeed.
Open a support ticket