-
-
Save randgroupmrkt/89068b3fbe8b9d97ad6bbee83c4ba645 to your computer and use it in GitHub Desktop.
add to functions.php : optimize wordpress heartbeat settings for admin pages
This file contains hidden or 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 | |
| // 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