Skip to content

Instantly share code, notes, and snippets.

@richerimage
Created July 11, 2016 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richerimage/277121e5c463a71e798a15edb14ae484 to your computer and use it in GitHub Desktop.
Save richerimage/277121e5c463a71e798a15edb14ae484 to your computer and use it in GitHub Desktop.
CHANGE THE DEFAULTS WITH THE DEFAULT_HIDDEN_META_BOXES HOOK
<?php
/**
* vpm_default_hidden_meta_boxes
* Source: https://www.vanpattenmedia.com/2014/code-snippet-hide-post-meta-boxes-wordpress
*/
function vpm_default_hidden_meta_boxes( $hidden, $screen ) {
// Grab the current post type
$post_type = $screen->post_type;
// If we're on a 'post'...
if ( $post_type == 'post' ) {
// Define which meta boxes we wish to hide
$hidden = array(
'authordiv',
'revisionsdiv',
);
// Pass our new defaults onto WordPress
return $hidden;
}
// If we are not on a 'post', pass the
// original defaults, as defined by WordPress
return $hidden;
}
add_action( 'default_hidden_meta_boxes', 'vpm_default_hidden_meta_boxes', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment