In 2013 WordPress introduces Heartbeat API – a feature that allows your browser to automatically communicate with the server. However, there are a couple of drawbacks to this feature.
If you use a shared hosting plan, you need to take a closer look at the CPU usage of your server. That’s because some hosting companies might suspend your account when you go over the limit.
Here, we’ll talk why WordPress Heartbeat API is it the usual suspect that causes the issue.
<?php
add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
wp_deregister_script('heartbeat');
}
?>
Replace 100 (seconds ) if you need.
<?php
function change_frequency_of_heartbeat_settings( $settings ) {
$settings['interval'] = 100; //Anything between 15-120
return $settings;
}
add_filter( 'heartbeat_settings', 'change_frequency_of_heartbeat_settings' );
?>
Open Scripts Organizer
Hit Add new.
Trigger Location: Everywhere
Script Location: PHP