Note that you must change "plugins.php" to match whatever page you want to allow.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Allow Heartbeat for Gravity Forms on WP Enting | |
* Plugin URI: https://gist.github.com/desrosj/409a17b718f07d1190b7 | |
* Description: Allow the Heartbeat API on Gravity Form related edit pages on WP Engine. Fork of https://gist.github.com/JPry/b1f6c55a5d5337557f97 | |
* Version: 1.0 | |
* Author: Jonathan Desrosiers | |
* Author URI: http://jonathandesrosiers.com/ | |
* License: GPL2 | |
*/ | |
// Prevent direct access to this file | |
if ( ! defined( 'ABSPATH' ) ) { | |
die( "You can't do anything by accessing this file directly." ); | |
} | |
/** | |
* Add a page to the list of pages where the Heartbeat API is allowed. | |
* | |
* Replace plugins.php with the actual page name. The page name correlates to the global $pagenow variable. | |
* See http://codex.wordpress.org/Global_Variables#Admin_Globals for more information about this | |
* global variable. | |
* | |
* @param array $heartbeat_allowed_pages The array of pages where the Heartbeat API is allowed. | |
* @return array The updated array of pages where the Heartbeat API is allowed. | |
*/ | |
function gform_add_heartbeat_allowed_page( $heartbeat_allowed_pages ) { | |
$heartbeat_allowed_pages[] = 'admin.php'; | |
return $heartbeat_allowed_pages; | |
} | |
add_filter( 'wpe_heartbeat_allowed_pages', 'gform_add_heartbeat_allowed_page' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment