How to eliminate Memory and CPU problems caused by WP-Cron

How to eliminate Memory and CPU problems

It is possible to use WordPress for years and not know what WP-Cron is until the day you check your server logs and realize that a process called WP-Cron.php is using up your memory and CPU which are some common problems caused by WP-Cron.

Let’s start by understanding what WP-Cron.php is:

WP-Cron is a script within the WordPress core that takes care of periodical maintenance tasks such as scheduling posts to go live at a future date, and for running Akismet’s spam filter.

If you own a WordPress site that doesn’t have much visitors or has a small number of pages/posts, you will not necessarily notice any problem with WP-Cron.php. However, if you have thousands of page views an hour and have hundreds of pages/posts, you might have an issue with WP-Cron.php and this is mostly because WP-cron.php will run as many times as the number of page views and site activity that you have in a day by default.

While WP-Cron.php is at the core of your WordPress installation, it can however be controlled to only work at certain intervals instead of working at will. This is exactly what you need to do to ensure that it doesn’t use up your CPU and Memory allocation.

Follow the steps numbered below to have your WP-Cron.php run at specifically defined intervals.

\"\"

  1. Login to your cPanel
  2. Click on the file manager option
  3. Select the wp-config.php and click on edit file
  4. Insert the following code right after the first line “define(‘DISABLE_WP_CRON’, true);“
  5. Save the file and exit
  6. Go to your cron access on your site and create a new cron job
  7. Enter the following line as the cron command “/usr/bin/wget -O /dev/null http://www.mydomain.com/wp-cron.php?doing_wp_cron”, replacing www.mydomain.com with your site domain
  8. Set the cron to run once a day if you don’t have much traffic and say every two to four hours if you have lots of traffic

If you do not understand any of the steps below, I will advise you get through to your web administrator to help you with the task as not understanding this steps means that you lack the technical know-how to complete the fix.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top