Created
July 11, 2016 06:05
-
-
Save richerimage/277121e5c463a71e798a15edb14ae484 to your computer and use it in GitHub Desktop.
CHANGE THE DEFAULTS WITH THE DEFAULT_HIDDEN_META_BOXES HOOK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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