Cron - is a task scheduled to run automatically at specific intervals. For instance, Cron could automatically back up a file every three hours. By default, WordPress does not use Cron for scheduling and other related tasks.
Method №1: Use cPanel
- Log in to cPanel.
- In the Advanced section of the cPanel home screen, click Cron.
- Under Cron Email, type the e-mail address that you want to receive notifications, and then click Update Email. Every time the cron job runs, the e-mail account will receive a message.
If you do not want to receive e-mail notifications for the Cron, you can append >/dev/null 2>&1 to the command, which redirects all output to /dev/null.
- Under Add New Cron Job, in the Common Settings list box, select Twice an hour.
You can run cron jobs a maximum of every 15 minutes on shared and reseller accounts. A 30-minute interval for the WordPress cron job should be more than sufficient.
- In the Command text box, type the following line:
cd ${HOME}/public_html; /usr/local/bin/php -q wp-cron.php
- Click Add New Cron Job. The new cron job settings take effect immediately.
Method №2: Use the command line
- Log in to your account using SSH.
- At the command prompt, type the following command:
crontab -e
- Type o to enter editing mode and start a new line of text.
- Type the following line, replacing username with your own A2 Hosting account username:
* * * * * cd ${HOME}/public_html; /usr/local/bin/php -q wp-cron.php
- This line assumes that you installed WordPress in the document root (public_html) directory. If you installed WordPress in another directory, modify the cd command to change to that directory instead.
This line assumes that you installed WordPress in the document root (public_html) directory. If you installed WordPress in another directory, modify the cd command to change to that directory instead.
- Press Esc, type :wq and then press Enter. The new cron job settings take effect immediately.
Comments
0 comments
Please sign in to leave a comment.