Skip to content

Instantly share code, notes, and snippets.

@bewho
Forked from randgroupmrkt/Index.md
Created May 14, 2017 02:06
Show Gist options
  • Save bewho/5fa644e3baa9c77b39330a16760adc0e to your computer and use it in GitHub Desktop.
Save bewho/5fa644e3baa9c77b39330a16760adc0e to your computer and use it in GitHub Desktop.
Wordpress Performance Tweaks
<?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
// limit revisions to 3
define('WP_POST_REVISIONS', 3);

//make auto save run less often
define('AUTOSAVE_INTERVAL', 600);

//empty trash every 3 days
define( 'EMPTY_TRASH_DAYS', 3 );

Added by @chrisbautista

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment