Wp-cron.php abuse

Back

The wp-cron.php is designed to run on each request that comes in to your site. This is fine for small sites but if you get a bad bot that takes advantage of this then it can take your site down by triggering many requests to your site, which in turn starts wp-cron.php with every request.

 

The better solution that only takes 2 minutes is to disable this functionality and create a cron task that runs every minute. This allows more visitors to your site at one time and stops bad bots taking your website out of action.

 

The first task is to disable wp-cron.php from running from WordPress.

You can either use the file manager in cPanel or login and use your favourite editor via SSH.

 

Edit your wp-config.php file and find the line define('DB_COLLATE', ''); After this line add;


define('DISABLE_WP_CRON', true);


Save and exit.


Now in the cPanel look for the "Cron Jobs" icon (Under the advanced section) and open it up.


Scroll down and under the common settigns drop down select "Once Per Minute(* * * * *)"


In the command box paste in the following;


/usr/local/bin/php /home/USERNAME/public_html/wp-cron.php


replace "USERNAME" with your cPanel username. You can compare the above with the example given on the cron page which will show you your username.


Click the Add New Cron Job


That's It!



Was this article helpful?
Dislike0 Like0

Views: 507