In the past, disabling wp-cron.php as you’ve done and running it via a cron job was a way to reduce the load on high-traffic accounts, but in the past several years, I have found that it has no longer been necessary because the WordPress developers have done a good job making it efficient.
How you set up the cron job will depend on your hosting control panel; e.g., cPanel. Your web host will be the best place to get help with that.
The thing that is bothering me is that it doesn’t make sense that with only 250 hits a day you’re having issues related to wp-cron.php. What you should probably do is take a look at the Codex article on optimizing WordPress. There are steps you can take, like running a caching plugin, that may provide more benefit than disabling wp-cron and running it as a cron job. The other thing to look at is if your hit count is accurate. You don’t mention where you’re getting the 250 number, but some stats programs separate live traffic from bots (automated traffic). If that’s the case, your site may be getting many more hits than that from bots, and blocking the bad bots may be a way to reduce the server load.
]]>Jim
]]>Ordinarily, you don’t have to alter wp-cron.php at all, just trigger it via your cron job. The command will look something like this, though it will vary depending on how your server is configured:
/usr/local/bin/php -q /home/username/public_html/wp-cron.php >/dev/null 2>&1
]]>
<!DOCTYPE html>
<html xmlns=”https://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Database Error</title>
</head>
<body>
<h1>Error establishing a database connection</h1>
</body>
</html>
–Jim
]]>I read everywhere that people disable it with
define(‘DISABLE_WP_CRON’. true);
(be careful, define(‘DISABLE_WP_CRON’. ‘true’); IS INCORRECT)
But at the end, even if you disable it, bots or anybody can run it by visiting this page:
wp-cron.php
So is there any solution to stop this script to run totally even if someone visits this page ? yourdomain.com/wp-cron.php
Thank you.
]]>