WordPress Cron job is a useful feature to automatically update blog contents at the cost of performance. Lets explore what is wp-cron.php and how to disable WP-cron for better performance.

seen from United States
seen from Singapore
seen from United Kingdom
seen from China
seen from China

seen from Malaysia
seen from China
seen from Indonesia
seen from France
seen from China
seen from United States
seen from United States
seen from China
seen from South Korea

seen from Colombia
seen from United States
seen from South Korea

seen from Germany
seen from United States

seen from Germany
WordPress Cron job is a useful feature to automatically update blog contents at the cost of performance. Lets explore what is wp-cron.php and how to disable WP-cron for better performance.
WPの予約投稿や更新チェックなどのタスクを定期実行する「wp-cron」は便利ですが無駄なアクセスを増やしサイトを重くする原因になります。この記事ではwp-cron機能を停止しパフォーマンスをアップさせ、予約投稿なども可能にする方法を紹介しています。
New Post has been published on WebSetNet
New Post has been published on http://websetnet.com/better-wp-cron-using-linuxs-crontab/
Better wp-cron using linux’s crontab
WordPress has something called wp-cron. If you haven’t head about it, its fine. But please be aware that you cannot live without it! That is why, I am not asking you to disable wp-cron.
Disable wp-cron
Still, we need to disable WordPress default wp-cron behaviour by adding following line to wp-config.php file:
define('DISABLE_WP_CRON', true);
Setup a real cronjob
From your Linux terminal, first open crontab:
crontab -e
Then add a line like below in it.
*/10 * * * * curl http://example.com/wp-cron.php > /dev/null 2>&1
OR
*/10 * * * * cd /var/www/example.com/htdocs; php /var/www/example.com/htdocs/wp-cron.php > /dev/null 2>&1
Please make sure you use correct path to wp-cron.php.
Above will run wp-cron every 10 minutes. You can change */10 to */5 to make it run every 5 minutes.
Difference between two-lines is, first one uses PHP-FPM (or PHP-CGI) and second one uses PHP-CLI. CLI scripts do not have time limits. Depending on your setup, it may be desirable or undesirable.
Is it recommend for high-traffic site?
I haven’t digged into wp-cron a lot but what I know is that it executes on every page-load. So if there is a long running process which gets triggers by wp-cron, it will delay page loading for that user.
Using crontab, wp-cron is run by independent PHP process. So it will not interfere with any visitors page-request.
Because of this, we highly recommend running wp-cron via linux crontab rather than WordPress’s default way, irrespective of size or traffic of your site.
What's a Cron Job?
What’s a Cron Job?
Cron Job…
What the heck is a Cron Job?!
According to Wikipedia,
The software utility cron is a time-based job scheduler in Unix-like computer operating systems. People who set up and maintain software environments use cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or intervals. It typically automates system maintenance or administration—though its…
View On WordPress