wordpress cron slowing site issue fixed

Many webmasters are facing wordpress cron slowing site issue. WordPress made in PHP, it has so provision for run the background job on certain time. WordPress made provision in CMS for task scheduler. For doing this for every request wp-cron.php is executing.

wp-cron.php is a virtual cron job executing file. This file may be checking for WordPress updates, sending email notifications, etc. WordPress will continue execute the wp-cron.php on each and every page load or request.

Due to execution on every request. Due to this, extra resource usage on your server. This cron job can take a minute or so to run, depending, on the size of the website. If your website doesn’t have a lot of visitors, it may not be an issue.

I have blogs which has huge traffic. Site slowness will impact your search engine ranking and site visitors.

What can be done to maximize the efficiency of the WordPress cron jobs? You can tell the WordPress installation that you’re going to handle the execution of the wp-cron.php file. We need to just use the following steps:

Open the wp-config.php file for editing and add the following line:

define('DISABLE_WP_CRON',
true);

I am using Linux VPS which has centos 6 version. So I started cron service using following command.

/etc/init.d/crond start

After that use following command to installation of cron

crontab -e

Cron has a specific syntax which is very easy to understand:

  • Minute
  • Hour
  • Day of month
  • Month
  • Day of week
  • Command to execute

Just copy and paste following code in your cron file. Following code will executing after every 1 hour instead of executing on every request of wordpress. Wp-corn.php will be executed after every 1 hour.

5 * * * * /usr/bin/wget https://purabtech.in/wp-cron.php?doing_wp_cron > /dev/null 2>&1

There are more samples which we can use in your cron file. Some samples as follows:

# hit this url to run the wordpress cron process every hour of every day

# this command will run at 12:05, 1:05, etc.

#curl https://purabtech.in/wp-cron.php > /dev/null 2>&1

#wget https://purabtech.in/wp-cron.php?doing_wp_cron > /dev/null 2>&1

above simple trick will solve the wordpress cron issue. I applied above changes to my site and this wordpress cron slowing site issue fixed.

Shared Hosting

If you are using shared hosting than using FTP program, you can change and replace wp-config.php file first. Use following steps:

1) Login to our control panel, manage your service and in the service controls area, click the Cron Jobs link.
2) Click the add new cron job button at the top right.
3) In the “Add New Cron Job” area, click the “Common Settings” drop-down menu select the option for “Once an hour”.
4) In the “Hour” drop-down menu, select “Every 6 hours”.
5) In the “URL” field, type in the following:

https://purabtech.in/wp-cron.php?doing_wp_cron

Note: do not forget to change domain instead of purabtech.in.