Hide Meta Boxes on Custom Post Type

This code goes in your functions file: http://pastebin.com/FntxMzGb

All you have to do is change “frog” on line 4 to match your custom post type name. *If you just want it for normal posts change “Frog” to “post”.

By default WordPress will not show anything in the array on line 5…so…if I wanted to hide my excerpt I would remove postexcerpt from the array.

That’s it!! 🙂

NOTE: This sets the default screen options, so if you have changed the options you may have to change the name of your custom post type or clean your database in order for the code to work.

// Change what's hidden by default
add_filter('default_hidden_meta_boxes', 'hide_meta_lock', 10, 2);
function hide_meta_lock($hidden, $screen) {
        if ( 'frog' == $screen->base )
                $hidden = array('postexcerpt','slugdiv','postcustom','trackbacksdiv', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
                // removed 'postexcerpt',
        return $hidden;
}
 

via WordPress › Support » Hide Meta Boxes on Custom Post Type.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.