

Turning off Heartbeat in WordPress made my day!
source link: https://hiddedevries.nl/en/blog/2016-02-08-turning-off-heartbeat-in-wordpress-made-my-day
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Turning off Heartbeat in WordPress made my day!
08 February 2016 ・ category: code
Heartbeat API is a thing built into WordPress that sends a POST request every 15 seconds. It allows for interesting functionalities like revision tracking, but can also dramatically slow things down and even block editors from editing content (if your connection is quite slow).
The “Edit” pages in WordPress use the Heartbeat API to detect connection loss. If they detect you’ve lost your connection, your ‘Update’/‘Publish’ button will get disabled until your connection is back.
“Connection lost” message on slow connections
When I was working on a WordPress site this week, I accessed the internet through my 3G MiFi, and added a VPN for security (the less glamorous side of working remotely). It resulted in seeing the ‘Connection lost’ message all the time. It would usually appear before I could make any changes, and never disappear. In which case it stopped me from editing content.

High CPU usage
Others comment that Heartbeat leads to high CPU usage: imagine having multiple instances of WordPress edit pages open in a browser, each sending its own POST requests every 15 seconds.
Turning Heartbeat off
Only when I just turned the whole thing off, I was able to make changes to my page. Turning Heartbeat off can be done by simply deregistering the script:
add_action( 'init', 'remove_heartbeat');
function remove_heartbeat() {
wp_deregister_script('heartbeat');
}
(via Aditya Nath Jha
Hidde de Vries (@hdv) is a freelance front-end and accessibility specialist in Rotterdam (NL), conference speaker and workshop teacher. Currently, he works for the W3C in the WAI team (views are his own). Previously he was at Mozilla, the Dutch government and various other organisations and businesses.
Leave a comment
Website
Occupation
Posted a response to this?
This website uses Webmentions. You can manually notify me if you have posted a response, by entering the URL below.
© 2007–2020 Hidde de Vries
NederlandsRecommend
-
21
Ok, I’ll admit, I’m not the largest fan of centralisation, but rarely do I so swiftly and effectively feel the crushing weight of it. I happen to use a very nice Chromium-b...
-
11
Save bandwidth by turning off TCP timestampsSave bandwidth by turning off TCP timestamps October 15, 2015 by Nerijus Bendžiūnas We care very much abo...
-
10
Ansible Quickie - Turning Off Services On A Group of Machines Oct 5, 2016 In my continuing investigation of
-
9
Ok, Ok, I'm Turning uPnP off. Addendum: Terramaster appear to have released a fix for this, although I have not tested it yet.
-
7
SEO We’re turning off AMP pages at Search Engine Land We've seen a big drop in traffic to AMP pages, suggesting that the inclusio...
-
8
Search Engine Land » Channel » Social » Marketers report Meta bug tu...
-
7
What is WordPress Heartbeat and How to Reduce Admin-ajax.php Hits
-
6
From first principles Turn a misbehaving computer off and on, or stop a misbehaving program and then start it again. Often, the problem goes away. Most users don’t think hard about this, and just accept...
-
7
Do...
-
6
Birchtree By Matt Birchler I've been writing here since 2010! Back when personal blogs were all the rage. Kids, a...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK