How to remove WordPress Meta Box

Home / Tutorials / Core / How to remove WordPress Meta Box

How to remove WordPress Meta Box

You may be using a plugin in your site and it comes with an unwanted meta box. This quick snippet will demonstrate how to remove a WordPress Meta Box from your edit screen.

What is a WordPress Meta Box?

A meta box is almost self explanatory. In the WordPress dashboard you may notice some draggable boxes especially on your post edit screen. Those boxes contains meta details for that post or registered post type. The widgets on the dashboard are also considered meta boxes as well. In another tutorial, we will look into how to add a meta box from scratch but for this short tut, we’re going to get rid of nuisance boxes.

The WP Codex list a function called remove_meta_box and we are going to use it to get the job done. The function uses 3 paramaters; id, page, context.

ID refers to the meta box. This can be found within the plugin code or can be found by inspecting the element.

Page refers to the screen which can be the dashboard, any registered post type, attachments etc.

Context is the position of the meta box and the options are normal, advanced and side.

Digging In

With that said, let’s write our function. For the purpose of this tutorial, we are going to remove a meta box from a post type, so we’ll call our function through the add_meta_boxes action

Extending Our Code

What we’ve written so far will remove the meta box with the ID “metabox_id” from the post post type. Next, we’ll make the function more dynamic to remove from multiple post types.

Real Life Examples

Here is how to remove WordPress SEO by Yoast

Removing Custom Post Fields Meta Box

Notes by the Codex

Because you can’t remove a meta box until it’s been added, it’s important to make sure your call to remove_meta_box() happens in the right sequence. Just adding a call to remove_meta_box() bare in your functions.php will probably not do the trick.

Resources

If you would like to learn more about removing meta boxes, you can check out the WordPress codex.

Remove Meta Box

How To Remove WordPress Post Meta Boxes

Remove unwanted meta boxes from WordPress Write Panels

How To Remove WordPress Meta Boxes for a Cleaner Look

 

 

Recommended Posts
Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Not readable? Change text. captcha txt

Start typing and press Enter to search