View Categories

How to Create a Server-Side Cron Job for WordPress

What is a server-side cron job for WordPress?

A server-side cron job is a scheduled task set up on your hosting server that triggers wp-cron.php on a fixed schedule, instead of relying on WP-Cron, which only runs when someone visits your site. It keeps scheduled emails, drip content and automations running on time.

How do you set up a server-side cron job?

  • Disable WP-Cron: Add define(‘DISABLE_WP_CRON’, true); to wp-config.php so WordPress stops running cron on page load.
  • Create the job: In your hosting panel such as cPanel, add a cron job every 15 minutes that calls your site’s wp-cron.php?doing_wp_cron URL with wget, curl or PHP CLI.
  • Verify it: Use a plugin such as WP Crontrol to check scheduled events and last run times.
  • Pick an interval: Every 5 minutes for emails and automations and every 15 minutes for general use.

Who should use a server-side cron job?

Use it if scheduled emails send late, automation workflows fail, or your site has low traffic and you need reliable background tasks for SCP features.


This guide explains how to properly set up a server-side cron job for WordPress. Using a real server cron is more reliable and accurate than WP‑Cron, especially for scheduled emails, drip content, automation workflows, and background tasks.


Why Use a Server-Side Cron Instead of WP‑Cron?

By default, WordPress uses WP‑Cron, which only runs when someone visits your site. This can cause:

  • Missed or delayed scheduled tasks
  • Emails not sending on time
  • Automation workflows failing

A server-side cron runs independently of site traffic and is the recommended approach for production sites.


Step 1: Disable WP‑Cron (Required)

Open your wp-config.php file and add the following line above the line that says /* That's all, stop editing! */:

define('DISABLE_WP_CRON', true);

This prevents WordPress from running cron jobs on page load.


Step 2: Identify the Correct Cron URL

WordPress provides a special endpoint for cron execution:

https://yourdomain.com/wp-cron.php?doing_wp_cron

Replace yourdomain.com with your actual website domain.

Examples:


Step 3: Log in to Your Hosting Control Panel

Log in to your hosting provider (cPanel, Plesk, or custom hosting dashboard).

Common hosting panels:

  • cPanel
  • Plesk
  • Cloudways
  • AWS / DigitalOcean (via SSH)

Step 4: Create a Cron Job (cPanel Example)

4.1 Open Cron Jobs

In cPanel, go to:

Advanced → Cron Jobs

4.2 Choose the Cron Schedule

Recommended schedule:

Every 15 minutes

Cron time settings:

Minute: */15
Hour: *
Day: *
Month: *
Weekday: *

This ensures WordPress cron tasks run frequently and reliably.


4.3 Add the Cron Command

Use one of the following methods (Method A is recommended).


Method A: Using wget (Recommended)

wget -q -O - "https://yourdomain.com/wp-cron.php?doing_wp_cron" >/dev/null 2>&1

Method B: Using curl

curl -s "https://yourdomain.com/wp-cron.php?doing_wp_cron" >/dev/null 2>&1

Method C: Using PHP CLI (Advanced)

/usr/bin/php /home/username/public_html/wp-cron.php

Replace:

  • /home/username/public_html/ with your actual server path

Step 5: Save the Cron Job

After adding the command, click Add New Cron Job or Save.

Your server cron is now active.


Step 6: Verify Cron Is Working

Option 1: Use a Plugin

Install a cron monitoring plugin such as:

  • WP Crontrol

Check:

  • Scheduled events
  • Last run times

Recommended Cron Frequency

Task TypeRecommended Interval
Emails / AutomationsEvery 5 minutes
Heavy background jobsEvery 10–15 minutes
Low priority tasksEvery 30–60 minutes

Common Issues and Fixes

Cron Not Running

  • Ensure DISABLE_WP_CRON is set to true
  • Verify the cron URL loads in a browser
  • Confirm SSL (https) works correctly

Hosting Blocks wget or curl

  • Ask hosting support to enable outbound requests
  • Use PHP CLI method instead

Best Practices

  • Always disable WP‑Cron when using server cron
  • Use HTTPS in cron URLs
  • Run cron every 15 minutes for reliability
  • Avoid running cron every minute unless required

Summary

  1. Disable WP‑Cron in wp-config.php
  2. Create a server cron job
  3. Run wp-cron.php every 15 minutes
  4. Verify cron execution

This setup ensures reliable scheduling, accurate email delivery, and stable automation in WordPress.