Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mehrshaddarzi/33cce4cd1c7ffdf2200ccb15e7375de6 to your computer and use it in GitHub Desktop.
Save mehrshaddarzi/33cce4cd1c7ffdf2200ccb15e7375de6 to your computer and use it in GitHub Desktop.
Default Hide MetaBox in wordpress
//https://wordpress.stackexchange.com/questions/15376/how-to-set-default-screen-options
add_filter( 'hidden_meta_boxes', 'custom_hidden_meta_boxes' );
function custom_hidden_meta_boxes( $hidden ) {
// Hide meta boxes on the single Post screen
// Left column
$hidden[] = 'postexcerpt'; // Post Excerpts
$hidden[] = 'trackbacksdiv'; // Send Trackbacks
$hidden[] = 'postcustom'; // Custom Fields
$hidden[] = 'commentstatusdiv'; // Discussion
$hidden[] = 'commentsdiv'; // Comments - Add comment
$hidden[] = 'slugdiv'; // Slug
$hidden[] = 'authordiv'; // Author
// Right column
$hidden[] = 'submitdiv'; // Publish
$hidden[] = 'formatdiv'; // Format (for themes that use Post Format)
$hidden[] = 'categorydiv'; // Categories
$hidden[] = 'tagsdiv-post_tag'; // Tags
$hidden[] = 'postimagediv'; // Featured Image
// Hide meta boxes on the single Page screen
// Left Column
$hidden[] = 'revisionsdiv'; // Revisions
$hidden[] = 'postcustom'; // Custom Fields
$hidden[] = 'commentstatusdiv'; // Discussion
$hidden[] = 'commentsdiv'; // Comments - Add comment
$hidden[] = 'slugdiv'; // Slug
$hidden[] = 'authordiv'; // Author
// Right column
$hidden[] = 'submitdiv'; // Publish
$hidden[] = 'pageparentdiv'; // Page Attributes
$hidden[] = 'postimagediv'; // Featured Image
return $hidden;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment