Contents

Search

Related Articles

How to Enable Two-Factor Authentication on Gmail

Adobe Acrobat Memory Could Not Be Read Fix

Fixing Microsoft Windows with DISM

Enabling TPM and Secure Boot for Battlefield 6

Upgrading to pfSense 2.8.0 — Fatal Trap 12 Wireless Card Error

Connect to a Wireless Network from the Windows 11 Login Screen

Using Shazam with Apple CarPlay Without Interrupting Audio

The Difference Between sudo apt-upgrade vs update

Fixing WordPress Scheduled Posts with a System Cron Job

The Problem

WordPress uses an internal system called WP-Cron to process scheduled posts and other background tasks. This system is only triggered when someone visits the site. If traffic is low, scheduled posts can fail to publish on time because the cron process never runs.

This issue is common on smaller websites or websites that rely on scheduled publishing but do not have a steady flow of visitors. It is also present on servers running OpenLiteSpeed with cache enabled, since the page cache can prevent visits from reaching WordPress in a way that triggers WP-Cron.

Symptoms You Might See

When this problem occurs, WordPress may show a “Missed Schedule” message in the admin dashboard. This means a post was supposed to be published automatically at a set time, but the internal cron system never ran to process it. If multiple posts are scheduled, you may see several “Missed Schedule” notices over time.

Replacing WordPress’ built-in cron with a real system cron job prevents these errors by ensuring scheduled tasks run on time, every time.

Step 1: Disable WordPress’ Built-In Cron

Open your WordPress configuration file (wp-config.php) and add the following line:

define('DISABLE_WP_CRON', true);

This ensures WordPress no longer waits for visitors to trigger scheduled tasks.

Step 2: Add a System Cron Job in Ubuntu

Choosing an Editor the First Time You Run Crontab

The first time you run crontab -e, Ubuntu will ask you to select a text editor. We recommend using nano, as it is the easiest option for new users.

You will see a menu like this:

Select an editor.  To change later, run 'select-editor'.
  1. /bin/nano        <---- easiest
  2. /usr/bin/vim.basic
  3. /usr/bin/vim.tiny
  4. /bin/ed

Choose 1-4 [1]: 1

Type 1 and press Enter to continue.

Using Nano to Edit the Crontab

When the crontab file opens in nano:

  1. Copy the cron command from the instructions below.
  2. Right-click inside the terminal window to paste the command into nano.
    • Most terminal applications use right-click for paste instead of keyboard shortcuts.
  3. Press CTRL+O (write out) and then Enter to save.
  4. Press CTRL+X to exit nano.

Add the Cron Job

Now add this line to run the cron every 5 minutes:

*/5 * * * * /usr/bin/php /var/www/html/wp-cron.php > /dev/null 2>&1
  • */5 * * * * → run every 5 minutes
  • /usr/bin/php → path to your PHP executable (check with which php)
  • /var/www/html/wp-cron.php → path to WordPress’ cron file (adjust if installed elsewhere)
  • > /dev/null 2>&1 → hides output (optional)

Save and exit. The cron service automatically reloads your new configuration. No restart is required.

Step 3: Test the Cron Job

Run the command manually to confirm it works:

php /var/www/html/wp-cron.php

If there are scheduled posts waiting, they should publish immediately.

Notes on OpenLiteSpeed and Caching

This method works with OpenLiteSpeed servers that use LiteSpeed Cache. The cron job runs directly at the server level, which means it does not rely on cache behavior or visitor traffic. This ensures scheduled posts publish reliably even when the website is cached or receives very little traffic.

Optional: Log the Output

If you want to verify that the cron job is executing, modify the crontab line:

*/5 * * * * /usr/bin/php /var/www/html/wp-cron.php >> /var/log/wp-cron.log 2>&1

This writes output to /var/log/wp-cron.log for troubleshooting.

With these steps, WordPress scheduled posts will run reliably every five minutes, eliminating “Missed Schedule” errors in the WordPress admin dashboard.