Three days ago arvixe telling my site using to much their cpu usage. They complaint about wp-cron.php and index.php process which I believe it was looping and won’t stop in background. wp-cron is just like cron job in normal condition. The crazy thing everyone doesn’t know is, it’s loading each time visitors coming to their site. I don’t know why wordpress don’t fix it or at least give options to run it each time frame.
For a site using wordpress and have a lot articles/pages the optimization for it is just disable wp-cron, another option is disable wp-cron and running cron job from cpanel which can be setup in time frame.
You will lose schedulle post feature but it’s better than get suspended right? You still can run cron in time frame you setup from cron job panel than using crazy method like spawn it each time visitors coming to your site. Let’s do this thing, it’s very easy…
- Open your wp-config.php and put this after the <?php. define(‘DISABLE_WP_CRON’, true);
- Open wp-includes folder and find a file with name cron.php
- Find string “function wp_cron() {“
- Replace all function with code below :
function wp_cron()
{// Prevent infinite loops caused by lack of wp-cron.php
if ( strpos($_SERVER['REQUEST_URI'], ‘/wp-cron.php’) !== false || ( defined(‘DISABLE_WP_CRON’) && DISABLE_WP_CRON ) )
return;if ( false === $crons = _get_cron_array() )
return;$local_time = time();
$keys = array_keys( $crons );
if ( isset($keys[0]) && $keys[0] > $local_time )
return;$schedules = wp_get_schedules();
foreach ( $crons as $timestamp => $cronhooks ) {
if ( $timestamp > $local_time ) break;
foreach ( (array) $cronhooks as $hook => $args ) {
if ( isset($schedules[$hook]['callback']) && !call_user_func( $schedules[$hook]['callback'] ) )
continue;
// spawn_cron( $local_time );
break 2;
}
}
} - Save it/replace cron.php file with the new edited cron.php
- Done
After doing this your wp-cron has been disabled and never ever run each time a visitors coming to your site. But you will lose schedulle post, to fix this problem open your hosting control panel and set cron job from there to run your wp-cron.php. You can set it run each 24 hours or in time frame you need.
After doing this small optimization arvixe not complaint to me. It’s mean this is maybe the big issue for worpdress to update their cron setting.
That’s a share for today, have a great day everyone, and Happy New Year!
SIMILAR POST :
- CRON JOB to Repair and Optimize Database
- PHP:Catching keyword from search engine
- Tips & Trick: Remove Google Image Search Frame.
- SEO: URL Rewrite for 4images
Incoming search terms:
- CRON
- wpcron malware infect functions php
- define(\disable_wp_cron\ true);
- cron job
- php call_user_func
- wp-cron fix
- cron jobs
- wp-cron and netfirms
- wp-cron cpu usage
- wp-cron php errors database
- wp-cron php how to replace cron job
- wp-cron php using too much cpu
- wp-cron stop
- wp-cron visits
- wp stop cron
- wp includes cron php infinite loop
- disable wordpress cron
- how to disable wp-cron php
- if ( strpos($_server[request_uri] /wp-cron php) !== false || ( defined(disable_wp_cron) && disable_wp_cron ) )
- php process usage
- php scheduler cron
- spawn_cron( $local_time ); cpu usage
- Stop and prevent others from framing your site in wp
- wp cron optimize
- wordpress stop cron php
If you're new here, you may want to subscribe to my RSS feed. You may copy or publish this article to your blog or other site as long you give credit link back to this site article. Thanks for visiting my blog!






Tag cloud
Blogs Statistic
Subscribe my feed

January 31st, 2012 at 3:20 PM
Howdy! This is kind of off topic but I need some guidance from an established blog. Is it tough to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about setting up my own but I’m not sure where to begin. Do you have any ideas or suggestions? With thanks
February 1st, 2012 at 1:14 AM
next time I will make everything more easier to follow and implement.
February 21st, 2012 at 8:49 AM
Awesome post.