Some simple steps to automate the execution of wp-cron.php.
- You can schedule it at convenient hours without affecting performance for users
- wp-cron.php become more reliable for almost time-critical tasks (updates, autopost, etc)
2 steps are needed:
- Disable the wp-cron execution from wordpress, in the wp-config.php file
- Edit your crontab by remote shell
How to disable wp-cron in wp-config.php:
open wp-config.php with your text editor and just add the following line at the end of the file:
Please pay attention in order to avoid blank spaces or newlines at the end of the file, and yes, it is normal that the php closing tag is missing.
Save (and upload if you need to) and here we have done.
How to setup a cronjob for wo-cron in Debian Crontab.
Log into your machine and open the user cronjob typing:
when your crontab will open just paste a line like following adjusting your path to the real one.
*/50 * * * * wget https://blog.giuseppeurso.net/wp-cron.php?doing_wp_cron > /dev/null 2>&1
On this page another approach is proposed and it would be useful for those who want to manage multiple cronjobs at time, but as you probaby already know, one of the advantages coming from using cron is to distribute tasks (the heavyest) in order to not affect (or at least try not affect) the average system performances.
Anyway the solution proposed is to schedule a php file containing the code needed to run the job.
Hope this help