Open boonebgorges opened 3 years ago
Boone, I wanted to check with WP Engine directly to understand what they're doing. After some back and forth with their support staff, they sent me their logic that deregisters heartbeat on most pages. Here it is:
`<?php /**
/**
pages. */ class WPE_Heartbeat_Throttle {
/**
/**
Check that heartbeat is allowed for this page and deregeister it if not. */ public function check_heartbeat_allowed() { global $pagenow;
/**
if ( ! in_array( $pagenow, $heartbeat_allowed_pages, true ) ) { wp_deregister_script( 'heartbeat' ); } } }`
I was thinking we could get in before their code runs to unhook it on our edit pages, but init
at 1
is pretty early. I've asked if they could just use wp_dequeue_script
instead of deregistering it. Otherwise, we could just re-register it when we need it.
Thanks for researching this. I think it's worth thinking about this as a specific solution for people who are on WPE and want to have the heartbeat functionality turned on for buddypress-docs. Maybe a useful thing for the wiki. But I still think we need to have a more graceful failure, as there are likely to be cases where heartbeat is disabled in ways other than this.
We use WP's Heartbeat API to power the 'Are you still editing?' feature. But this causes problems when Heartbeat is disabled broadly, as it is by WPEngine and perhaps others. See #477.
In these cases, we should fail more gracefully. I think this means something like this: