Return to Snippet

Revision: 55692
at February 17, 2012 18:18 by f6design


Initial Code
/**
 * Remove meta boxes.
 */
function remove_meta_boxes() {
    // Only proceed if user does not have admin role.
    if (!current_user_can('manage_options')) { 
	remove_meta_box( 'submitdiv', 'post', 'normal' ); // Publish meta box
	remove_meta_box( 'commentsdiv', 'post', 'normal' ); // Comments meta box
	remove_meta_box( 'revisionsdiv', 'post', 'normal' ); // Revisions meta box
	remove_meta_box( 'authordiv', 'post', 'normal' ); // Author meta box
	remove_meta_box( 'slugdiv', 'post', 'normal' );	// Slug meta box
	remove_meta_box( 'tagsdiv-post_tag', 'post', 'side' ); // Post tags meta box
	remove_meta_box( 'categorydiv', 'post', 'side' ); // Category meta box
	remove_meta_box( 'postexcerpt', 'post', 'normal' ); // Excerpt meta box
	remove_meta_box( 'formatdiv', 'post', 'normal' ); // Post format meta box
	remove_meta_box( 'trackbacksdiv', 'post', 'normal' ); // Trackbacks meta box
	remove_meta_box( 'postcustom', 'post', 'normal' ); // Custom fields meta box
	remove_meta_box( 'commentstatusdiv', 'post', 'normal' ); // Comment status meta box
	remove_meta_box( 'postimagediv', 'post', 'side' ); // Featured image meta box	
	remove_meta_box( 'pageparentdiv', 'page', 'side' ); // Page attributes meta box
    }
}
add_action( 'add_meta_boxes', 'remove_meta_boxes' );

Initial URL


Initial Description
Remove meta boxes from the Wordpress admin area. Useful for simplifying Wordpress' admin interface for your clients. Add this snippet to your Wordpress theme's functions.php file.

Initial Title
Wordpress: Hide Admin Meta Boxes

Initial Tags
wordpress

Initial Language
PHP