Sponsored By

Sign in to follow this  
mikemansell

How can I disable post revisions in WordPress?

Recommended Posts

I'm trying to use as few resources as possible on my WordPress installation. Is there anything I can do to disable post revisions? These seem to take up a bit of space and are not really necessary for what I need. Do you have any other tips for making WordPress a more efficient platform?

Share this post


Link to post
Share on other sites

In your wp-config.php file, add the following after define ('WPLANG', '');:

/** Stop post revisions and extend autosave interval. */
define('AUTOSAVE_INTERVAL', 900); // delay autosave
define('WP_POST_REVISIONS', false); // turn of post revisions

Some other wp-config.php edits that might speed things up a bit:

/** Blog address and site address */
define('WP_HOME', 'http://www.yourdomain.com'); // no trailing slash
define('WP_SITEURL', 'http://www.yourdomain.com'); // no trailing slash

/** Template path and stylesheet path specification */
define('TEMPLATEPATH', '/home/user/public_html/mysite/wp-content/themes/mytheme');
define('STYLESHEETPATH', '/home/user/public_html/mysite/wp-content/themes/mytheme');

/** Automated trash emptying */
define('EMPTY_TRASH_DAYS', 7); // empty weekly

Note that the second definition will disable active theme switching within the Administrator's dashboard. Comment out when you need to switch themes; revert when done.

These are theme-specific tweaks that must be added to your theme's functions.php file. They are not all performance-enhancing tweaks. The comments should give you a general idea, however.

// Disable RSS feeds
function disable_our_feeds() {
wp_die( __('<strong>ERROR:</strong> We are sorry, but RSS feeds have been disabled on this website for privacy purposes. Please click <a href="http://www.monambbs2014.com/" >this link</a> to return to the homepage.') );
}
add_action('do_feed', 'disable_our_feeds', 1);
add_action('do_feed_rdf', 'disable_our_feeds', 1);
add_action('do_feed_rss', 'disable_our_feeds', 1);
add_action('do_feed_rss2', 'disable_our_feeds', 1);
add_action('do_feed_atom', 'disable_our_feeds', 1);

// Custom Dashboard logo
add_action('admin_head', 'my_custom_logo');
function my_custom_logo() {
echo '
<style type="text/css">
#header-logo { background-image: url('.get_bloginfo('template_directory').'/path/to/image.jpg) !important; }
</style>
';
}

// Specify favicon for Dashboard
function favicon4admin() {
echo '<link rel="Shortcut Icon" type="image/x-icon" href="http://www.yourdomain.tld/favicon.ico" />';
}
add_action( 'admin_head', 'favicon4admin' );

// Remove WordPress version from header
add_filter( 'the_generator', create_function('$a', "return null;") );

// De-clutter wp_head
// Really Simple Discovery
remove_action('wp_head', 'rsd_link');
// Windows Live Writer
remove_action('wp_head', 'wlwmanifest_link');
// BbLD header ad
remove_action('wp_head', 'bbld');
// Post and comment feed links
remove_action( 'wp_head', 'feed_links', 2 );
// Category feed links
remove_action( 'wp_head', 'feed_links_extra', 3 );
// Index link
remove_action( 'wp_head', 'index_rel_link');
// Start, previous and current links
remove_action( 'wp_head', 'parent_post_rel_link');
remove_action( 'wp_head', 'start_post_rel_link');
remove_action( 'wp_head', 'adjacent_posts_rel_link');

// Add canonical links for comments
function canonical_for_comments() {
global $cpage, $post;
if ( $cpage > 1 ) :
echo "\n";
echo "<link rel='canonical' href='";
echo get_permalink( $post->ID );
echo "' />\n";
endif;
}
add_action( 'wp_head', 'canonical_for_comments' );

// Disable WordPress autosave
function disableAutoSave(){
wp_deregister_script('autosave');
}
add_action( 'wp_print_scripts', 'disableAutoSave' );

// Specify use of single custom gravatar
if ( !function_exists('fb_addgravatar') ) {
function fb_addgravatar( $avatar_defaults ) {
$myavatar = get_bloginfo('template_directory').'/path/to/gravatar.png';
$avatar_defaults[$myavatar] = 'Caduceus';
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'fb_addgravatar' ); }

Edited by Falcon1986

Share this post


Link to post
Share on other sites

You do realize this post is 10 yrs. old ????

Chuck

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this