Simplify WordPress Editing Screens Using remove_post_type_support

WordPress 3.0 introduced several new functions for managing custom post types. One of these functions is the poorly documented remove_post_type_support:

remove_post_type_support( $post_type, $feature )

At first glance, this function seems rather useless, since you can easily define the list of features that a custom post type supports when you first register it using register_post_type. But here’s something interesting I discovered recently while building a WordPress site for one of my clients: remove_post_type_support works just as well with the standard WordPress post types such as ‘post’ and ‘page’ as it does with custom post types.

For example, the following code snippet, when placed in your functions.php file, will remove the Custom Fields meta box from the post editing screen:

function remove_custom_fields_from_posts() {
remove_post_type_support( 'post', 'custom-fields' );
}
add_action( 'init', 'remove_custom_fields_from_posts' );

Why would anyone want to remove this feature from WordPress? Because it is an easy and effective way to simplify the WordPress editing screens for the benefit of non-technical users.

Suppose you are creating a brochure site for a client that does not make use of custom fields or featured images, and does not allow comments or pingbacks. You don’t want the editing screens to be cluttered with extra meta boxes that the client does not need. Removing them makes it easier to train the client in using WordPress, and helps them to focus only on those areas of the admin interface that they need to be concerned with.

For example, here is the function I wrote for my last client to simplify the post and page editing screens. Note that remove_post_type_support does not accept an array of features to be removed, so you must remove each feature separately (this limitation may be fixed in a future release of WordPress):

function simplify_post_editing_screens() {
remove_post_type_support( 'post', 'custom-fields' );
remove_post_type_support( 'post', 'thumbnail' );
remove_post_type_support( 'post', 'comments' );
remove_post_type_support( 'post', 'trackbacks' );
remove_post_type_support( 'post', 'excerpt' );
 
remove_post_type_support( 'page', 'custom-fields' );
remove_post_type_support( 'page', 'thumbnail' );
remove_post_type_support( 'page', 'comments' );
remove_post_type_support( 'page', 'trackbacks' );
}
add_action( 'init', 'simplify_post_editing_screens' );

Here is the complete list of features that may be removed using this method. I recommend removing all features that are not needed. This, plus a few tweaks with a plugin like Admin Menu Editor, will make your client’s life much easier.

‘title’
‘editor’
‘author’
‘thumbnail’ (featured image)
‘excerpt’ (posts only)
‘trackbacks’ (posts only)
‘page-attributes’ (template and menu order, pages only)
‘custom-fields’
‘comments’
‘revisions’

More From the Blog

Comments

Comments are closed.