Skip to content

Instantly share code, notes, and snippets.

@joshuadavidnelson
Created January 10, 2014 17:32
Show Gist options
  • Save joshuadavidnelson/8358745 to your computer and use it in GitHub Desktop.
Save joshuadavidnelson/8358745 to your computer and use it in GitHub Desktop.
Remove post metaboxes per specific post
<?php
/**
* Remove Post Metaboxes on a specific post
*
* @link http://wordpress.stackexchange.com/questions/74280/remove-metabox-from-specific-page-template-in-admin#74283
*/
add_action( 'admin_menu', 'jdn_remove_post_meta_boxes' );
function jdn_remove_post_meta_boxes()
{
if( isset( $_GET['post'] ) && $_GET['post'] == '3' )
{
remove_meta_box('tagsdiv-post_tag', 'post', 'normal');
remove_meta_box('categorydiv', 'post', 'normal');
remove_meta_box('postimagediv', 'post', 'normal');
remove_meta_box('authordiv', 'post', 'normal');
remove_meta_box('authordiv', 'page', 'normal');
remove_meta_box('postexcerpt', 'post', 'normal');
remove_meta_box('trackbacksdiv', 'post', 'normal');
remove_meta_box('commentstatusdiv', 'post', 'normal');
remove_meta_box('commentstatusdiv', 'page', 'normal');
remove_meta_box('postcustom', 'post', 'normal');
remove_meta_box('postcustom', 'page', 'normal');
remove_meta_box('commentstatusdiv', 'post', 'normal');
remove_meta_box('commentsdiv', 'post', 'normal');
remove_meta_box('revisionsdiv', 'post', 'normal');
remove_meta_box('authordiv', 'post', 'normal');
remove_meta_box('authordiv', 'page', 'normal');
remove_meta_box('slugdiv', 'post', 'normal');
remove_meta_box('slugdiv', 'page', 'normal');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment