How to Disable WordPress Cron jobs initiated by wp-cron.php? Use cPanel Cron job instead

Last updated
App Shah

Crunchify » WordPress Optimization and Tutorials » How to Disable WordPress Cron jobs initiated by wp-cron.php? Use cPanel Cron job instead

How to Disable WordPress Cron Jobs - use cPanel Cron job instead

Disabling the wp-cron.php in WordPress

Recently I came across a need to disable all WordPress Cron Jobs as some of the woocommerce jobs and Disqus sync cron jobs were using lots of CPU.

In this tutorial we will go over simple steps by which you could disable all WordPress Cron jobs. This tutorial will also help if you have any one of below questions:

  • Can I disable Cron job?
  • High server load and dsq_sync_forum problem
  • How to Replace WordPress Cron with a Real Cron Job?
  • Disable WordPress Cron Jobs WP-CRON.php
  • Properly Setting Up WordPress Cron Jobs
  • How to Disable wp-cron Running in the Background?

Step-1

Open wp-config.php file

Step-2

Add below line to wp-config.php file. Make sure you backup existing file just incase required.

define('DISABLE_WP_CRON', 'true');

This will disable WordPress Cron job functionality on your site. We want to do this only if you don’t want some plugin or themes to create so many Cron jobs.

Take a look at an issue on Github which I’ve created for Yoast SEO plugin. I believe, it’s fix now. Now as we have disabled all cron jobs how to run some required cron jobs like:

wp_version_check
wp_update_plugins
wp_update_themes
wp_scheduled_delete
....
....

Another way to disable wp-cron.php execution is to use .htaccess file. Take a look at this tutorial.

Step-3

  • Go to cPanel
  • Search for Cron Jobs under Advanced Section

Search for Cron Jobs under cPanel Advanced Section

Step-4

Setup Cron job with below parameter. Make sure you update username with your cPanel username.

cd /home/username/public_html; php -q wp-cron.php

If you have installed WordPress under some directory like /crunchify then please add /crunchify in above command. Your new command should look like below:

cd /home/username/public_html/crunchify; php -q wp-cron.php

Setup Cron Jobs in cPanel runs every 12 hours

And you are all set. You should see Cron job setup successfully.WordPress Cron job setup successfully in cPanel

Above cron job which we setup in cPanel will run every 12 hours and execute all required cron jobs.

4 thoughts on “How to Disable WordPress Cron jobs initiated by wp-cron.php? Use cPanel Cron job instead”

  1. hello! You actually dont need to make a ‘cd’ to the install folder; you can run it as follows:
    php -q /home/username/public_html/crunchify/wp-cron.php

    Reply

Leave a Comment