How can I disable post revisions in WordPress?


Recommended Posts

  • 2 weeks later...

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
Link to post
Share on other sites
  • 7 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...