When create websites for clients using WordPress, especially for non-blogging purposes where custom post types are used, you might want to remove unnecessary meta boxes in post editing page to keep the page clean and easy to operate. To reach that goal, simply put these lines in functions.php
file of your theme:
add_action( 'admin_menu', function(){ remove_meta_box( 'postexcerpt', 'post', 'normal' ); remove_meta_box( 'postcustom', 'post', 'normal' ); remove_meta_box( 'trackbacksdiv', 'post', 'normal' ); remove_meta_box( 'slugdiv', 'post', 'normal' ); remove_meta_box( 'authordiv', 'post', 'normal' ); remove_meta_box( 'commentstatusdiv', 'post', 'normal' ); }
Change post
to custom post type slug if you want to remove meta boxes in editing page for custom post type.
For more information about remove_meta_box()
function, please read the Codex.
Leave a Reply