• Hello,

    I have DISABLE_WP_CRON set to true for my staging site. It shows the message “The DISABLE_WP_CRON constant is set to true. WP-Cron spawning is disabled.” (not surprising). However, I see that the crons are still getting executed.
    I see in the access logs that there are calls like
    POST /wp-cron.php?doing_wp_cron=1622578886.9215939044952392578125 . I was assuming that since the DISABLE_WP_CRON true crons shouldn’t be executed unless I specifically call the wp-cron.php, isn’t that true? does this plugin bypass the DISABLE_WP_CRON setting?

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

    (@johnbillion)

    WordPress Core Developer

    This plugin doesn’t bypass anything but it does directly call spawn_cron() if you manually run a cron event by pressing the Run Now link next to an event (it does this so the event runs immediately). In this case WordPress will trigger a request to wp-cron.php.

    Are you using the Run Now feature?

    Thread Starter arunkott

    (@arunkott)

    Thank you for the reply @johnbillion

    No. I am not using the run Now feature

    I went back and did some more testing and here is what I got so far.

    • DISABLE_WP_CRON is set to true.
    • Plugin’s event page shows The DISABLE_WP_CRON constant is set to true. WP-Cron spawning is disabled.
    • I also ssh and did
      /public_html $wp cron test
      Error: The DISABLE_WP_CRON constant is set to true. WP-Cron spawning is disabled.
    1. I disabled all plugin. uninstalled , reinstalled the WP Control and activated it
    2. at 02/Jun/2021:18:21:30 UTC , I added a new event, set it run at 18:25:00 UTC and repeat every minute.
    3. Left the admin page open (so it is making ajax calls in some intervals)
    4. At 02/Jun/2021:18:25:01 I see the ‘POST /wp-cron.php?doing_wp_cron’ in my access logs. I also see the hooked function is also executed (it updates a counter in db)
    5. At 02/Jun/2021:18:26:06 I see another request to wp_cron.php and it repeated every minute and updated counter in db
    6. I closed the admin page. From then I dont see any traffic in access logs. I waited 20 mins or so.
    7. at 02/Jun/2021:18:50:31 , I opened the admin page again and left it open. Requests started getting logged and I started seeing ‘POST /wp-cron.php?doing_wp_cron’ in every other minute

    I understand the logic of spawning cron when clicking run now. I am wondering why it still running cron on schedule when DISABLE_WP_CRON is true

    • This reply was modified 3 years, 6 months ago by arunkott. Reason: clarified question
    • This reply was modified 3 years, 6 months ago by arunkott.
    Thread Starter arunkott

    (@arunkott)

    I did some more check ??

    1. I deactivated the WP Control plugin. Strangely it makes 1 call to the wp_cron.php and then no calls are made. I would conclude that as all the calls that came earlier were indeed from the plugin
    2. I activated the plugin after few minutes. Strangely the event I added earlier was gone from the list. Is that expected behavior? why would it delete the event just by deactivating the plugin ?
    3. I added the event manually again , set start time to a future time and set repeat every minute and kept admin page open.
    4. Requests for wp_cron.php started again and started repeating every 2 minutes.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Is it supposed to run crons if DISABLE_WP_CORON is true ?’ is closed to new replies.