Skip to content

Instantly share code, notes, and snippets.

Last active February 13, 2020 07:55
What would you like to do?
[WordPress] Using the default_hidden_meta_boxes hook to remove meta boxes from the dashboard of a custom post type.
add_action( 'default_hidden_meta_boxes', 'acme_remove_meta_boxes', 10, 2 );
* Removes the category, author, post excerpt, and slug meta boxes.
* @since 1.0.0
* @param array $hidden The array of meta boxes that should be hidden for Acme Post Types
* @param object $screen The current screen object that's being displayed on the screen
* @return array $hidden The updated array that removes other meta boxes
function acme_remove_meta_boxes( $hidden, $screen ) {
if ( 'acme_post_type' == $screen->id ) {
$hidden = array(
return $hidden;
Copy link

Thanks for the tip, but I would rather use hidden_meta_boxes filter instead as default_hidden_meta_boxes might not be triggered depending on your settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment