• Resolved Ron Strilaeff

    (@ronstrilaeff)


    I can’t seem to find a clear explanation of why wordpress executes it’s own wp-cron.php everytime a page loads.

    If I use your plugin, can I safely add this code to my wp-config.php file?

    define(‘DISABLE_WP_CRON’, true);

    Or would I still need to add a server cron job to make the “cron events” in my site execute?

    https://www.ads-software.com/plugins/wp-crontrol/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Hi Ron,

    WordPress only executes wp-cron.php when it needs to. On every page load, WordPress checks to see if there are any cron jobs that need to run (this is quite a cheap operation) and if so it calls wp-cron.php asynchronously (which is potentially an expensive operation) which in turns runs any cron jobs that need running.

    If wp-cron.php is being executed on every page load then there’s something wrong with cron on your site. You can use WP Crontrol to see what jobs are scheduled.

    If you add define('DISABLE_WP_CRON', true); to your config file you’ll need to manually set up a server cron to call that file at an appropriate interval. WP Crontrol only shows you what jobs are scheduled.

    Thread Starter Ron Strilaeff

    (@ronstrilaeff)

    Thanks for replying and sorry for the almost duplicate question. I immediately fell in love with this plugin by the way since I have numerous background functions to prepare meta data and cleanup garbage that I’ve been triggering off of periodic user or admin actions. It is nice to have a ui to keep track of them (and actually change them or execute manually ). Thanks for doing this.

    I did not realize there were two parts to the built in wp-cron.

    Now that you enlightened me that it won’t do any work (other than a quick check) unless it has an event scheduled, it looks like there is no significant advantage in disabling the built in wp-cron.

    It would only take a few milliseconds for wp to check a few cached db records (the scheduled tasks).

    From your experience, is it ever worth disabling?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can I safely disable_wp_cron?’ is closed to new replies.