DEV Community

Cover image for How to Remove Unwanted Meta Boxes in WordPress
WP Meta Box Plugin
WP Meta Box Plugin

Posted on • Originally published at metabox.io

How to Remove Unwanted Meta Boxes in WordPress

In the post editor or page editor, even admin dashboard, there are different meta boxes available. Perhaps, some of them are unused and you want to remove them to make your working screen clearer. It helps you to concentrate on the main contents better. Let's learn how to remove unwanted meta boxes in WordPress.

You can use code or plugin as follows.

Method 1: Use Code to Remove Unwanted Meta Boxes in WordPress

WordPress has the remove_meta_box function for doing this. Here is its structure:

remove_meta_box( string $id, string|array|WP_Screen $screen, string $context )

You can read more about the parameters of the above function here.

For example, in the post editor section, there is a default meta box named Custom Fields.

There is a default meta box named Custom Fields

I will add the below code in the function.php file to remove this meta box:

add_action( 'admin_menu', function() {

    remove_meta_box( 'postcustom', 'post', 'normal' );

} );

Then, it is no longer there:

Insert code in the function.php file to remove this meta box.

Another example, there are many different meta boxes to display general website information or shortcuts in the Admin Dashboard:

There are many different meta boxes to display general website information or shortcuts in the Admin Dashboard

I will try removing them with the below code:

add_action( 'wp_dashboard_setup', function() {

    remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );

    remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );

} );

Then, the Dashboard becomes tidier.

Result of removing meta boxes from the Dashboard.

Method 2: Use a Plugin to Remove Unwanted Meta Boxes in WordPress

There are many plugins for removing meta boxes. I've tried some of them and find Adminimize to be a good choice.

The Adminimize plugin is free and available on wordpress.org.

[wp-pic type="plugin" slug="adminimize" layout="large" ]

After installing the plugin, go to Settings > Adminimize. In this section, you will see that it provides many features, not only removing meta boxes.

After installing the plugin, go to Settings > Adminimize.

Go to Write options - Post to deactivate the meta boxes from the post editor in Post. If you want to remove the meta box in other post types, choose Write options - [post type].

This plugin allows you only to deactivate meta boxes, not completely delete them as using code

As you can see, this plugin allows you only to deactivate meta boxes, not completely delete them as using code. But the special feature of this plugin is that you can deactivate each type of meta boxes for different user rolls. Thus, you can restrict users to view meta boxes to prevent them from changing information.

Last Words

If you want to remove meta boxes completely so that no one can find them, using code is the better choice. If you want to authorize each user role to view just some kinds of them, using a plugin is perfect. Both of them are simple and quick.

One more thing, using plugin Adminimize also helps you customize the appearance of others in the admin bar, backend options, plugin settings,... You should dig in it to take more advantages from it.

If you have other ideas, please share with us in the below comment box.

Top comments (0)