WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to keep wp-cron from firing? (14 posts)

  1. Jonathan Landrum
    Member
    Posted 7 years ago #

    Future-dated posts with wp-cron never worked on my install. A couple days ago the help desk at my host showed me how to fix it using real cron.

    However, wp-cron.php is still being requested every minute and a half by my server. What code do I need to edit to keep that from happening?

    It's not hurting anything, but it's a waste of resources.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Why is wp-cron not being run? If it's being requested, then it should be running.

    If you want WordPress to stop hitting wp-cron, then you need to let it actually perform its job correctly.

  3. Jonathan Landrum
    Member
    Posted 7 years ago #

    Why is wp-cron not being run? If it's being requested, then it should be running.

    No one really knows why it doesn't work. It's not just my install, but it is apparently quite rare.

    If you want WordPress to stop hitting wp-cron, then you need to let it actually perform its job correctly.

    I tried that:

    Future-dated posts with wp-cron never worked on my install.

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    No one really knows why it doesn't work. It's not just my install, but it is apparently quite rare.

    Well, then you are screwed. Without knowing what the actual problem is, then it's sorta difficult to fix it.

    Future-dated posts with wp-cron never worked on my install.

    Well, of course not. wp-cron isn't being allowed to work, so naturally, future dated posts are not going to work either, because it's wp-cron that actually *posts* them when it comes time to do so.

    You can try this:
    In wp-cron.php, you'll find this code:

    if ( $_GET['check'] != wp_hash('187425') )
    	exit;

    Comment that out by adding // in front of each line. This disables the check that prevents you from running it manually.

    Next, you will manually run wp-cron.php by calling its address in a browser.

    If this doesn't allow it to run, then you really are screwed and need to find a new webhost who doesn't have these sorts of issues. It will work on a standard box running standard configurations. Whatever they've done to break it makes them way, way non-standard.

  5. Jonathan Landrum
    Member
    Posted 7 years ago #

    No kidding. That's how I fixed it. It works now, if I kick it with real cron.

    I'm not having a problem with future-dated posts anymore; I got it working. I want to know how to get WP to quit asking for wp-cron since I'm getting it myself.

    Here's a few threads to get you up to speed on the future-post issue:

    http://wordpress.org/support/topic/119811
    http://wordpress.org/support/topic/108112
    http://wordpress.org/support/topic/109363
    http://trac.wordpress.org/ticket/3565
    http://trac.wordpress.org/ticket/3742

    The first one is where I posted my host's duct tape fix.

  6. Jonathan Landrum
    Member
    Posted 7 years ago #

    Never mind; found it myself.

    wp-includes > cron.php comment out line 125:

    124 continue;
    125 //spawn_cron();
    126 break 2;

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Huh. That's weird. It should only actually spawn cron when there's actual jobs that need to be run.

    You might take a look in the database, using phyMyAdmin or what have you, and see what's in the wp_options table under the key of "cron". The content of the value for that field is a big array telling it what actions to perform and when. The trick here is that wp-cron erases those after it has performed them. So it makes no sense that it's actually hitting wp-cron every minute or so, because those actions should have been performed already.

  8. Jonathan Landrum
    Member
    Posted 7 years ago #

    That's what I was thinking. It seems to be spawning a new instance every time the site is hit.

    The cron key shows "a:1:{s:7:"version";i:2;}"
    The doing-cron key shows "0"

  9. Jonathan Landrum
    Member
    Posted 7 years ago #

    I wonder if it's a plugin blocking it, since it's getting a 403 when it tries to run. I had Referrer Karma running for a while, which issued 403's to bad sites. Maybe something like that is getting int he way? (Referrer Karma's no longer installed.)

  10. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    jon: Check carefully and make sure there's not another entry with a "cron" key in there. There was one case a while back where somebody had two entries for some weird reason.

    Also, you might try simply deleting that cron row from the database entirely. It should then recreate it empty. I think.

  11. Jonathan Landrum
    Member
    Posted 7 years ago #

    I didn't see another one yesterday when I went through there. I had nearly 500 keys in that table, mostly from deleted plugins. I cleared all the garbage out that I could identify, but I still feel like I have a lot of house cleaning to do in my database. I'll delete the key and see if it reforms.

    Edit: the key is gone. One curious thing I noticed in that table is the vast ammount of rss_foo keys. About half of them seem to have a UNIX timestamp as their data value, and the other half say something about MagpieRSS feed parser. What is that?

  12. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Those are cached RSS feeds that you have pulled with Magpie. You can safely remove them, it will just get them again if need be.

    Make sure that you only remove the rss_LargeAmountsOfJunkHere rows, there are other rss_* keys that are not cache entries.

  13. Jonathan Landrum
    Member
    Posted 7 years ago #

    Meh. I'll leave them. I was just curious.

    Back to the topic, and simply for the sake of argument, here's the list of plugins I currently employ:

    • Akismet
    • Clutter-Free
    • CSS Naked Day
    • Decurlify RSS
    • DoFollow
    • flickrRSS
    • Full Text Feed
    • Google Sitemaps
    • http:BL WordPress Plugin
    • No Self Pings
    • Permalink Redirect
    • Search Everything
    • Search Excerpt
    • Smart Archives
    • Spam Karma 2
    • Subscribe To Comments
    • WordPress.com Stats
    • WP-DBManager
    • WP-PageNavi
    • WP AJAX Edit Comments
  14. ozzywood
    Member
    Posted 6 years ago #

    Believe it or not but the lovely people at GODADDY took my site down yesterday without warning, THEN sent me an email which contained:

    512 [GET] script-consultants.net/blog/wp-cron.php?check

    No wonder I am moving my hosting elsewhere.

Topic Closed

This topic has been closed to new replies.

About this Topic