#Index
-
-
Save bewho/5fa644e3baa9c77b39330a16760adc0e to your computer and use it in GitHub Desktop.
Wordpress Performance Tweaks
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 | |
// 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