
How to Limit or Completely Stop WordPress Heartbeat API
- March 1, 2016
- Leave a comment
WordPress Heartbeat API introduced in WordPress 3.6 is a wonderful functionality provided to plugin developers. It is responsible for stuff like revision tracking, session management, etc. But in some cases, it can increase your CPU cycles and slow down your website and hosting server. If you review your server requests from the browser console, you will see the following pulse generated by the API after every 15 seconds:
POST /wp-admin/admin-ajax.php “http://example.com/wp-admin/index.php
This pulse verifies your connection to the hosting server.
The pulses frequency may increase. Your server most-likely will go down when multiple users log-in to the website back-end at the same time because every single wp back-end login requests for wp-admin ajax.
Solution:
If you are a single user to the website and you are sure that nobody else is going to log into the back-end, you can either disable the heartbeat by a plugin “Heartbeat Control” or simply inserting the following code snippet in functions.php file:
1 2 3 4 |
add_action( 'init', 'stop_heartbeat', 1 ); function stop_heartbeat() { wp_deregister_script('heartbeat'); } |
User Comments