| Server IP : 162.215.171.210 / Your IP : 216.73.216.20 Web Server : Apache System : Linux 162-215-171-210.bluehost.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : swansondentalgro ( 1070) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/swansondentalgro/.trash/mu-plugins-old/wpengine-common/ |
Upload File : |
<?php
/**
* WP Engine Heartbeat Throttle
*
* @package wpengine/common-mu-plugin
*/
/**
* A class for throttling back the heartbeat of a WordPress page. This class controls
* the heartbeat rate and even disables the heartbeat for all pages except post editing
* pages.
*/
class WPE_Heartbeat_Throttle {
/**
* Register the actions/hooks that make this throttle work.
*/
public function register() {
add_action( 'init', array( $this, 'check_heartbeat_allowed' ), 1 );
}
/**
* Check that heartbeat is allowed for this page and deregeister it if not.
*/
public function check_heartbeat_allowed() {
global $pagenow;
/**
* Filter the pages where heartbeat.js is allowed to load.
*
* @since 2.1.13
*
* @param array $heartbeat_allowed_pages Array of pages where the heartbeat.js file is allowed to be loaded.
*/
$heartbeat_allowed_pages = apply_filters( 'wpe_heartbeat_allowed_pages', array( 'edit.php', 'post.php', 'post-new.php', 'site-health.php' ) );
if ( ! in_array( $pagenow, $heartbeat_allowed_pages, true ) ) {
wp_dequeue_script( 'heartbeat' );
}
}
}