To set up a WordPress cron job using the command line, follow these steps:
- 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 cpanel account username:
*/30 * * * * cd /home/username/public_html; /usr/local/bin/php -q wp-cron.php
NB:This line sets the cron job to run every 30 minutes.
- Press Esc, type : wq and then press Enter. The new cron job settings take effect immediately.