Skip to content

Instantly share code, notes, and snippets.

@paaljoachim
Last active October 14, 2018 08:33
Show Gist options
  • Save paaljoachim/5b9335010d0f54a886325670babbfca8 to your computer and use it in GitHub Desktop.
Save paaljoachim/5b9335010d0f54a886325670babbfca8 to your computer and use it in GitHub Desktop.
Hide meta boxes in the single page and post screen. Turn them on again in the Screen Options. Add the code to your WordPress child theme functions file or a custom functions plugin.
// At http://wordpress.stackexchange.com/questions/15376/how-to-set-default-screen-options bottom comment the following code $hidden is mentioned.
// Hides meta boxes. Turn them on through the 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