Question
How can the default WordPress cron be replaced with a real cron job?
Answer
WordPress's wp-cron is not a real cron job. Rather than running at a scheduled time, it runs as the pages load, causing low-traffic sites to miss scheduled posts. Creating a cronjob to run wp-cron will ensure that scheduled posts are not missed regardless of site traffic.
- Open the site's
wp-config.phpfile in a text editor, either through SSH or the cPanel File Manager. -
Add the following line after the
<?phpline.CONFIG_TEXT: define('DISABLE_WP_CRON', true);
- Save the changes and close the text editor.
- Log into the user's cPanel account.
- Open the "Cron Jobs" application in the "Advanced" section of cPanel.
-
Create a new cron job that runs the following command every 15 minutes.
CONFIG_TEXT: wget -q -O - http://domain.tld/wp-cron.php?doing_wp_cron >/dev/null 2>&1
CPANEL_WARN: "domain.tld" must be replaced with the site's domain name.
Additional Resources
How to edit files via File Manager
How to edit a file on command-line
How to create or edit cron jobs in the cPanel user interface
Comments
0 comments
Article is closed for comments.