Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save randgroupmrkt/89068b3fbe8b9d97ad6bbee83c4ba645 to your computer and use it in GitHub Desktop.

Select an option

Save randgroupmrkt/89068b3fbe8b9d97ad6bbee83c4ba645 to your computer and use it in GitHub Desktop.
add to functions.php : optimize wordpress heartbeat settings for admin pages
<?php
// as include for functions.php
function optimize_heartbeat_settings( $settings ) {
$settings['autostart'] = false;
$settings['interval'] = 60;
return $settings;
}
add_filter( 'heartbeat_settings', 'optimize_heartbeat_settings' );
function disable_heartbeat_unless_post_edit_screen() {
global $pagenow;
if ( $pagenow != 'post.php' && $pagenow != 'post-new.php' )
wp_deregister_script('heartbeat');
}
add_action( 'init', 'disable_heartbeat_unless_post_edit_screen', 1 );
// end heartbeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment