General Topics

WordPress Heartbeat Oops Causing Site Errors

In this article, we will talk about WordPress heartbeat which is causing for different errors like internal server error etc. If you see the best blogging platforms. Then WordPress will show on the top of the list. Because this is an open source free software with a lot of features. Often beginners confuse while choosing the software and the website. They select .com instead of .org software and after that. They know that they choose the wrong platform.

So here we have published an article about it: difference between .com and org. This is a software which can easily install with one click and manually install in the CPanel. WordPress.org is a great invent of great developers. But some of the new inventions make site speed slower. In fact, it’s a background script. The script run every time with a specific period and cause of CPU resource usage CPanel.

What is WordPress Heartbeat?

Know more explanation about it. It takes from the heart beating word. Because heartbeat API generates pulses with different actions. In fact, WordPress heartbeat is a script and create communication between browser and server. However, WordPress heartbeat introduced in the version of 3.6. WordPress heartbeat features are as below:

  • Post auto drafting
  • Post revision track

WordPress Heartbeat Working

The script which used by WordPress heartbeat is “/wp-admin/admin-ajax.php” WordPress. This is a nice feature of this software which tracks every moment of the dashboard. But the issue of this script is that. It runs every time and makes causes of excessive resource usage CPanel. And due to resource usage you face internal server error.

In fact, the problem starts when an admin login and minimize the window. Then admin-ajax.php working repeatedly after a specific time.

When scripts execute then it leads to resource usage CPanel. And if you want to rid of excessive resource usage CPanel. Then disable this feature by using some simple codes.

How To Disable WordPress Heartbeat Completely?

Now see how to disable completely? For disabling this feature of WordPress you need to access function.php.

If you want to disable completely. Then just copy the below code and paste this in your function.php after opening tag <?php.

*/
add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
 wp_deregister_script('heartbeat');
}
/**

WordPress Sitemap XML Declaration Allowed

After pasting, this code some functions of your website will not available. But it will work great against excessive resource usage CPanel. By the way, you can disable this while using your admin dashboard.

How To Disable WordPress Heartbeat From Admin Panel?

If you want to disable this feature only from your Admin Panel then use the below code in your function.php. Keep in mind don’t use more than one code at a time. Because it will make the cause of different difficulties.

add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
global $pagenow;
if ( $pagenow == 'index.php' )
wp_deregister_script('heartbeat');
}

Disable from post.php and post_new.php pages

By using the below code we can alive for the post and post_new.php pages where the most need of this.

add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
global $pagenow;
if ( $pagenow != 'post.php' && $pagenow != 'post-new.php' )
wp_deregister_script('heartbeat');
}

By the addition of the above code in your site’s function.php. The Heartbeat will disable but keep alive on post.php and post_new.php pages. This is the best option which keeps away from enabling and disable option again and again. We will suggest you that don’t open your admin area every time. Just open your WordPress admin area when you need to work. Otherwise, log out or close the window. It also helps to use less resource usage CPanel.

If you have another idea about WordPress heartbeat. Then don’t forget to share in the comment section. If you are a beginner and don’t want to take the risk. Then read here: how to control with plugin?

Show More

Muhammad Awais Azeem

"Global Blurb since 2015" M. Awais Azeem is the CEO and founder of Global Blurb. The blog designed to share ideas about different topics. My profession is Accountant and I have completed CA Inter from Institute of Chartered Accountants of Pakistan. Me and my time present to sort out any issue regarding SEO, Blogging, Content Marketing and WordPress. Hire Us and Goodbye difficulty.

Related Articles

Want to contribute