博客

由负责您托管服务的团队提供教程、指南、产品资讯和技术见解。

Hosting Guides

What Is a Cron Job in cPanel, and How Do You Set One Up for WordPress?

6 11月 2026 2 分钟阅读
分享此文章

Jobs such as backups, newsletter sends, stock syncs or publishing scheduled posts should run by themselves at set intervals. On Linux servers, cron does this. The Advanced › Cron Jobs tool in cPanel lets you add scheduled tasks without writing code.

Reading the schedule

Each cron job is defined by a five-field schedule:

FieldMeaningExample
1Minute (0–59)*/15 = every 15 minutes
2Hour (0–23)3 = at 03:00
3Day of month (1–31)1 = on the 1st
4Month (1–12)* = every month
5Day of week (0–6, 0 = Sunday)1 = Monday

For example, 30 2 * * * runs every day at 02:30, and */15 * * * * runs every 15 minutes. Remember which time zone the server clock uses; the Cron Jobs screen usually shows the server's current time.

WordPress's wp-cron system

WordPress doesn't use a real cron for scheduled tasks. It runs them through wp-cron.php, triggered when a visitor arrives. That has two weaknesses:

  • On low-traffic sites, tasks run late; a scheduled post may not publish on time.
  • On busy sites, it can be triggered far more often than needed and create unnecessary load.

Replacing wp-cron with a real cron

  1. In wp-config.php, add this line before /* That's all, stop editing! */:
    define( 'DISABLE_WP_CRON', true );
  2. Open Cron Jobs in cPanel and choose Once Per Fifteen Minutes from the "Common Settings" list.
  3. In the command field, enter this command with your own domain:
    curl -s https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
  4. Click Add New Cron Job.

The >/dev/null 2>&1 at the end stops an email being sent on every run. When you first set it up, removing that part for a while and reading the cron emails is an easy way to confirm the job runs without errors.

Things to watch

  • Don't run jobs more often than needed. A heavy job running every minute keeps pushing your account's CPU limit. See CPU, RAM and I/O limits.
  • Don't add two jobs that do the same thing; compare plugins' own cron suggestions with the job you added.
  • If a job that runs a script directly fails with "permission denied", see the file permissions guide; don't set the permission to 777.
  • Delete old jobs you no longer use. A removed plugin's job can keep calling a missing file and producing errors.

If the Cron Jobs screen doesn't appear on your account, or you can't work out why a job isn't running, open a support ticket.

评论0

暂无评论

成为第一个分享想法的人。

参与讨论

请登录或注册后发表评论。

不错过任何文章

通过电子邮件接收我们最新的教程、指南和产品资讯。

您已订阅我们的电子通讯。