Skip to content

Instantly share code, notes, and snippets.

@desrosj
Forked from JPry/heartbeat_allowed.php
Last active February 10, 2016 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save desrosj/409a17b718f07d1190b7 to your computer and use it in GitHub Desktop.
Save desrosj/409a17b718f07d1190b7 to your computer and use it in GitHub Desktop.
Note that you must change "plugins.php" to match whatever page you want to allow.
<?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