wp-cron events stopped working and are showing next run in the past

It sounds like your WordPress cron jobs (wp-cron.php) are not firing correctly, which is a common issue. When the “next run” time is in the past, it means the system that triggers these events isn’t working as expected.

Here’s a step-by-step guide to help you diagnose and fix the problem:

1. Understand How WordPress Cron Works

WordPress cron is not a true system cron. It relies on visits to your website to trigger wp-cron.php. When someone visits your site, WordPress checks if there are any scheduled tasks due. If so, it attempts to run them.

2. Check if wp-cron.php is Disabled

Sometimes, wp-cron.php is intentionally disabled (e.g., if a server-side cron is already in place, but not configured correctly).

  • Access your wp-config.php file: You can do this via FTP/SFTP or your hosting control panel’s file manager. It’s usually located in the root directory of your WordPress installation.
  • Look for this line:
    define('DISABLE_WP_CRON', true);
    
  • If you find it: This line disables WordPress’s built-in cron. If you didn’t set up a server-side cron to replace it, this is likely the cause.
    • Option A (Recommended for most): Change true to false or comment out the line by adding // at the beginning:
      // define('DISABLE_WP_CRON', true);
      

      Save the file and check if your cron events start running.

    • Option B (If you want to use server-side cron): Keep it true and proceed to step 4 to set up a proper server-side cron.

3. Manually Trigger wp-cron.php

You can try to manually trigger wp-cron.php to see if it runs.

  • Open your web browser.
  • Go to http://yourdomain.com/wp-cron.php?doing_wp_cron (replace yourdomain.com with your actual domain).
  • You should see a blank page, which is normal. This attempt might trigger any overdue cron jobs.
  • Check your cron events again (e.g., using a plugin like WP Crontrol). If they updated, it confirms wp-cron.php can run, but isn’t being triggered automatically.

4. Set Up a Server-Side Cron Job (Recommended for Performance)

If your site gets very little traffic, or if you want more reliable cron execution, it’s best to disable WordPress’s internal cron and set up a system-level cron job on your server.

  • Disable WordPress Cron (if not already): Add or ensure this line is in your wp-config.php file:
    define('DISABLE_WP_CRON', true);
    
  • Access your Hosting Control Panel: Log in to your hosting account (cPanel, Plesk, etc.).
  • Find “Cron Jobs” or “Scheduled Tasks”: The exact location varies by host.
  • Add a New Cron Job:
    • Common Settings:
      • Frequency: Usually every 5 or 15 minutes.
      • Command: This is the critical part. Here are common examples; choose the one that works for your server setup:
        • Using wget (most common and easiest):
          wget -q -O - http://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
          

          Replace http://yourdomain.com with https://yourdomain.com if your site uses SSL.

        • Using curl:
          curl --silent http://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
          
        • Using PHP CLI (more robust, requires correct PHP path):
          /usr/bin/php /home/yourusername/public_html/wp-cron.php >/dev/null 2>&1
          

          You’ll need to replace /usr/bin/php with the actual path to your PHP executable and /home/yourusername/public_html/ with the absolute path to your WordPress installation’s root directory. Ask your host for these paths if you’re unsure.

  • Save the Cron Job.
  • Monitor: Wait for a few intervals (e.g., 15-30 minutes) and then check your WordPress cron events again using WP Crontrol. They should now be running on schedule.

5. Check for Plugin or Theme Conflicts

If the above steps don’t resolve the issue, a plugin or theme might be interfering with wp-cron.php.

  • Deactivate all plugins: Go to Plugins > Installed Plugins in your WordPress admin and deactivate all of them.
  • Switch to a default theme: Go to Appearance > Themes and activate a default WordPress theme like Twenty Twenty-Four.
  • Check cron events: See if the cron jobs start running.
  • Reactivate one by one: If they start working, reactivate your plugins one by one, checking the cron events after each activation, until you find the culprit. Do the same for your theme.
  • Contact the plugin/theme developer: Once you identify the problematic plugin/theme, contact its developer for support or look for alternatives.

6. Server Resource Issues

In rare cases, severe server resource limitations or extremely long-running cron tasks can cause wp-cron.php to time out or fail. This is harder to diagnose without server access. If you suspect this, check your server error logs or contact your hosting provider.

By following these steps, you should be able to identify and resolve the issue with your WordPress cron events.

Related Posts


Recreated CubeWP Fields Not Showing on Frontend? Easy Fix Guide

It can be perplexing when you’ve set up your custom fields in CubeWP, they appear correctly in...

WordPress Page Loads Blank on Edit

When your WordPress page loads blank when you try to edit it, it often points to a conflict or resou...

How to Keep WordPress Dropdown Menu Open on Child Pages | Step-by-Step Guide

Improving user experience in WordPress often involves tweaking navigation menus. A common request is...

CSS in WordPress: Single Stylesheet vs. Page-Specific Files – What’s Best?

WordPress developers often face the dilemma of choosing between a single consolidated CSS file or mu...

Recent Posts