The WordPress Heartbeat API uses /wp-admin/admin-ajax.php to run AJAX calls from the web browser. While this is great and all it can also cause high CPU usage and crazy amounts of PHP calls. For example, if you leave your dashboard open it will keep sending POST requests to this file on a regular interval, every 15 seconds.
Here is an example below of it happening.
Disable the Heartbeat API
Follow the steps below to disable the Heartbeat API and or modify where you want it to run.
Click into the Perfmatters plugin settings.
Make sure you’re on the “General” submenu.
Scroll down and choose an option under “Disable Heartbeat.”
There are three options built into the plugin to help minimize this:
- Leave as default
- Disable everywhere
- Only Allow When Editing Posts/Pages
We recommend the last one and that is the setting we use on our sites. This will drastically decrease the number of requests.
Scroll down and click “Save Changes.”
If you are using a page builder plugin like Elementor, you will want to use the third option above. Disabling Heartbeat everywhere will sometimes cause problems with page builders’ functionality.
Make sure to also check out our other option to change the Heartbeat API frequency.