This article describes how to configure a cron job for WordPress.
A cron job is a task scheduled to run automatically at specific intervals. For example, a cron job could automatically back up a file every six hours.
In its default configuration, WordPress does not use a real cron job for scheduling and other related tasks. Instead, whenever a page is loaded on a WordPress site, WordPress runs the wp-cron.php file. Although this “virtual” cron job is convenient, it has a few disadvantages:
To resolve these issues, you can disable the default virtual WordPress cron job, and configure a real cron job. To do this, follow the procedures below.
To disable the default virtual WordPress cron job, follow these steps:
define('DISABLE_WP_CRON', true);
Make sure you add the previous line before the following line in the wp-config.php file:
/* That's all, stop editing! Happy publishing. */
After you have disabled the default WordPress cron configuration in the wp-config.php file, you are ready to set up a real cron job that runs at fixed intervals regardless of site traffic.
If your account includes cPanel access, you can use it to configure the cron job. Otherwise, you can configure the cron job from the command line.
To set up a WordPress cron job using cPanel, follow these steps:
cd ${HOME}/public_html; /usr/local/bin/php -q wp-cron.php
To set up a WordPress cron job using the command line, follow these steps:
crontab -e
Type the following line, replacing username with your own A2 Hosting account username:
*/30 * * * * cd ${HOME}/public_html; /usr/local/bin/php -q wp-cron.php
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
Usamos cookies para personalizar o site para você e para analisar o uso do nosso site. Você demonstra que concorda com isso ao clicar em "Eu concordo" ou ao continuar usando este site. Mais informações sobre cookies podem ser encontradas em nossa Política de privacidade.