• cgoulding

    (@cgoulding)


    Last week I activated CloudFlare. I also upgraded to the latest version of WordPress at roughly the same time. Since then, my cron jobs stopped running according to schedule. I have gone through and checked numerous settings, consulted with CloudFlare support and made tweaks and changes there, to no avail. I first noticed the problem when a scheduled post did not get published. And when I check my rss feed, the content remains that of the pre-CloudFlare addition and pre-Wordpress update. I can resynch the feed (I use feedburner) and I can get it to update for a few seconds or minutes, but then it reverts back to the old content.

    I installed the WP Core Control plugin to view what was happening with the cron jobs and several show that they are scheduled to run daily, twice daily, etc. but the next scheduled run time on sevearl of them is listed as a week ago, i.e. about the time I did the WordPress update and added CloudFlare. I ran some of the cron jobs manually, and then my feed sent out an e-mail with some even older posts that had already been sent in a previous feed e-mail.

    I’ve spent many hours researching and troubleshooting this problem and don’t know what to try next. I’m not a tech newbie, but I’m not that versed in php or mysql, so there may be something obvious I am missing in the files or database. If anyone can point me in a fruitful direction for resetting or fixing the broken cron, I would be most grateful.

    Here is my site: https://www.thegermanprofessor.com
    And the feed that won’t update: https://feeds.feedburner.com/TheGermanProfessor

Viewing 9 replies - 1 through 9 (of 9 total)
  • cq3abn

    (@mprewitt3abn)

    I think I may have the same problem. Since upgrading to WP 3.7.x, my database backups have stopped working. This happens in a couple different websites, which are not even using the same backup plugins. On one of my websites, I’m using BackWPup, and it currently says the next scheduled weekly backup is set for October 27, which is 11 days ago. It’s supposed to be a weekly job. I was able to manually run it, and it completed without error; however, even after the manual run, it still says next job is set for October 27.

    esmi

    (@esmi)

    @mprewitt3abn: As per the Forum Welcome, please post your own topic.

    cq3abn

    (@mprewitt3abn)

    I was also able to trigger the job using wp-cron.php?doing_cron, and it completed successfully.

    cq3abn

    (@mprewitt3abn)

    FYI, it appears this could be a result of using W3 Total Cache, which I am using. So as a help to others and maybe the OP, disabling W3 Total Cache temporarily may fix the issue. See https://www.ads-software.com/support/topic/plugin-w3-total-cache-w3-stops-cronjobs?replies=6 for details.

    Thread Starter cgoulding

    (@cgoulding)

    Yes, I am becoming more and more convinced it is linked to the last 3.7.1 WP upgrade. I, too, can trigger the wp-cron.php manually, but it won’t run the jobs as scheduled. I have tried bypassing the wp-cron entirely and set up a cron job through my cPanel, but none of the commands I have tried will work. I am not that familiar with uaing the command line. I’ve cobbled together some possible commands by reading through my host documentation and finding bits of code on the Internet that people have successfully used to set up cron jobs. None of them have worked for me.

    I don’t believe it has anything to do with caching plugins unless the latest 3.7.1 upgrade broke the plugin. I had W3 Total Cache installed many weeks before this problem occurred. Disbling the plugin has no effect on the problem.

    I also discovered the the XML of my feed is correct and that feedburner was just not updating correctly. This may or may not be connected to the cron. After spending hours trying to fix up, I’m in the process of moving my feed off feedburner to solve that issue.

    OGC

    (@umyob)

    Hi @cgoulding,

    I was having the EXACT same problem and my hosting service suggested I remove CloudFlare as it may be causing my site to fail to resolve correctly. HOWEVER, I suspected the issue was really with the WP scheduler included in WordPress, so I did some further research. I got my cron jobs to run again by adding the line

    define(‘ALTERNATE_WP_CRON’, true);

    to my wp-config.php file. This activates the alternate scheduler in WP. Also, make sure your hosting service has not disabled the WP Scheduler – look for this line in your wp-config.php file and remove it (or change true to false with no quotation marks around the word false):
    define(‘DISABLE_WP_CRON’, true)

    I left CloudFlare activated, so I don’t believe that had anything to do with the cron jobs running or not. Also, de-activating W3 Total Cache had absolutely no effect on the cron jobs – they still failed to run until I added the line above to wp-config.php

    Here is where I found the info: https://www.ads-software.com/support/topic/backups-not-running?replies=3 (the forum thread is about the UpdraftPlus plugin, which I do not use, but the info is still helpful, obviously).

    OGC

    (@umyob)

    IMPORTANT: the solution above adds extra characters to your site URLs: “&doing_wp_cron=###################”. I did not like this, and it seemed to cause problems with the Redirection plugin, so I disabled both WP schedulers in the wp-config.php file (make sure to remove the line
    define(‘ALTERNATE_WP_CRON’, true);:
    if you added it as stated in my previous reply).

    Add these lines to wp-config.php
    /**
    * Disable WP Scheduler and WP Alternate Scheduler
    */
    define(‘DISABLE_WP_CRON’, true);
    define(‘ALTERNATE_WP_CRON’, false);

    and set up a cron job in the cPanel to make a get request to the wp-cron.php file at regular intervals as instructed here.

    After additional research, I learned my problem is that I use Bluehost and they don’t allow loopbacks so WP can call wp-cron.php – therefore no cron jobs were running for my site. However, Bluehost does allow you to set up your own cron jobs via the Cron Jobs tool in the cPanel. So, you can disable WP calling the wp-cron.php file and set up your own cron job to request the file at regular intervals like 5 minutes (or 1 minute or whatever you want).

    Like so:
    cPAnel -> Advanced -> Cron Jobs -> Common Settings: Every 5 minutes -> Command: wget https://www.yourwebsite.com/wp-cron.php?doing_wp_cron=1 > /dev/null 2>&1 (MAKE SURE TO REPLACE/INSERT YOUR WEBSITE URL) -> Add New Cron Job

    Thread Starter cgoulding

    (@cgoulding)

    I posted a few days ago, or so I thought, that I had implemented the fix that you describe in your last post. I, too, have Bluehost.

    The only version of the command that would work for me is the following:
    GET https://www.yourwebsite.com/wp-cron.php?doing_wp_cron

    If I add parameters or use anything but GET, it will not work. I have set it to run ever 15 minutes.

    Interestingly enough, if I add
    define(‘DISABLE_WP_CRON’, true);
    to the wp-config.php file, my fix will not work. So I left this out.

    I don’t know whether what I’m doing is good practice or syntax. But it works. The cron is running again, though it does appear that a few of the scheduled tasks run more frequently than they need to. I’m not sure what to attribute this to.

    Hi @cgoulding,

    The purpose of adding

    define('DISABLE_WP_CRON', true);

    to wp-config.php is to actually disable wp-cron.php, so that is expected behaviour.

    Check wp-cron.php and you will confirm it.

    Anyway thanks for reporting that WP 3.7.1 has broken wp-cron.php, it helped me to make an alternate wp-cron2.php file that at least works for my plugin scheduled task.

    (I wonder if WordPress 3.8 still has this issue, does anybody knows about it?)

    Regards,
    Gabriel

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘wp-cron is broken’ is closed to new replies.