Skip to content

Instantly share code, notes, and snippets.

@sambody
Created June 14, 2013 11:07
Show Gist options
  • Save sambody/5781062 to your computer and use it in GitHub Desktop.
Save sambody/5781062 to your computer and use it in GitHub Desktop.
WP: Remove metaboxes from posts and pages editor.
<?php
/* Remove metaboxes for POSTS - uncomment to activate
*/
function remove_my_post_metaboxes() {
// under the editor
//remove_meta_box( 'authordiv','post','normal' ); // Author Metabox
//remove_meta_box( 'commentstatusdiv','post','normal' ); // Comments Status Metabox
//remove_meta_box( 'commentsdiv','post','normal' ); // Comments Metabox
remove_meta_box( 'postcustom','post','normal' ); // Custom Fields Metabox
//remove_meta_box( 'postexcerpt','post','normal' ); // Excerpt Metabox
remove_meta_box( 'revisionsdiv','post','normal' ); // Revisions Metabox
//remove_meta_box( 'slugdiv','post','normal' ); // Slug Metabox
remove_meta_box( 'trackbacksdiv','post','normal' ); // Trackback Metabox
// sidebar
//remove_meta_box( 'categorydiv','post','normal' ); // Categories Metabox
//remove_meta_box( 'formatdiv','post','normal' ); // Formats Metabox
//remove_meta_box( 'postimagediv','post','normal' ); // Featured Image Metabox
//remove_meta_box( 'submitdiv','post','normal' ); // Submit Metabox (?)
//remove_meta_box( 'tagsdiv-post_tag','post','normal' ); // Tags Metabox
}
//add_action('admin_menu','remove_my_post_metaboxes'); // uncomment to activate
/* Remove metaboxes from PAGES - uncomment to activate
*/
function remove_my_page_metaboxes() {
remove_meta_box( 'postcustom','page','normal' ); // Custom Fields Metabox
//remove_meta_box( 'postexcerpt','page','normal' ); // Excerpt Metabox
remove_meta_box( 'commentstatusdiv','page','normal' ); // Comments Metabox
remove_meta_box( 'trackbacksdiv','page','normal' ); // Talkback Metabox
//remove_meta_box( 'slugdiv','page','normal' ); // Slug Metabox
//remove_meta_box( 'authordiv','page','normal' ); // Author Metabox
}
add_action('admin_menu','remove_my_page_metaboxes');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment