#Index
Last active
May 14, 2017 02:06
-
-
Save randgroupmrkt/21e1cf3193471bda7178c5dd766f42e8 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