Users may prefer to schedule WordPress cron tasks for certain daily or weekly times, whether it is to reduce application load during peak periods or ensure certain tasks are completed at a given time.
Using the Cron Jobs function within cPanel we can easily create a cron task for our WordPress website- we recommend this especially for clients who have CPU heavy websites and would like to increase website performance during (for example) business hours.
In this guide, we will disable WordPress automated cron tasks and schedule the WordPress cron tasks to be completed daily at midnight.
To follow this tutorial you will need your SFTP details and cPanel login credentials on hand (these are the same). If you have forgotten your credentials, they were included in the original ‘Welcome to Serversaurus Hosting’ email which you should be able to find in your inbox otherwise follow these instructions on how to update your cPanel password.
1. Open your terminal window and ssh to your hosting server (please update the below command with your SFTP login details):
ssh username@yourserver.serversaurus.com.au
When prompted, enter your password
2. Change into your public_html directory:
cd public_html
3. Open the .htaccess file:
vi wp-config.php
4. Add the following text to the end of your wp-config.php file, to insert the text firstly type i to enter insert mode, then paste the text below:
define('DISABLE_WP_CRON', true);
5. Now we have disabled WordPress' automated cron tasks, let's create the WordPress cron schedule within cPanel. Please login to cPanel and use the search bar to find Cron Jobs function.
6. Within the Cron Jobs function, scroll down to view the Add New Cron Job section, now select Once Per Day option from the Common Settings down down menu.
The form will auto fill the time schedule based on your selection.
7. For the task to launch WordPress cron process, enter the below string into the Command section, be sure to update the string with your domain name:
wget -q -O - http://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
Now select Create New Cron Job to save.
Comments
0 comments
Please sign in to leave a comment.