How To Remove WordPress Meta Boxes for a Cleaner Look

The WordPress post page (where you write your posts) can get a little crowded for some people’s taste.

Code for Removing Meta Boxes
Remove Meta Boxes from Pages

For example, take a look at this screenshot of the section below the write/edit screen. It’s jam-packed with different types of meta boxes.

Of course, if you want to remove a lot of that messiness, you can pull down the Screen Options panel at the top of the page and uncheck whatever you like.

While that works, you might have a situation where you want all of those meta boxes removed automatically. Maybe you’re dealing with clients or site users who don’t need to learn yet another little something they have to do. Or maybe you don’t want those boxes available to them regardless.

While there are a number of plugins that will do this for you, in this post, we’re going to show you how you can do that by placing some code in your functions.php file.

Code for Removing Meta Boxes

The code below has comments in it, so you can add or remove whatever you like. For example, if you’d like to keep the excerpts meta box, then you should be able to easily identify the line that applies to excerpts and take that line out.

Place the following code in your functions file (Appearance > Editor > Theme Functions – functions.php).

Placing that code should remove all the meta boxes below the post editor and give you a nice, clean look. The yellow outline is where all the meta boxes used to be.

Of course, those boxes under the post editor aren’t the only meta boxes on that screen. There are also the more important meta boxes to the right of the editor.

There is code to remove those too, but we’ll separate it out here because it’s less likely that people would want those boxes removed. If you do, however, you’d simply need to copy and paste whichever line you’d like into the lines of code above. (The one meta box that many may want to get rid of here is the Formats box.)

*Note: the code for removing the Featured Image meta box doesn’t seem to work (and hasn’t for a while for some reason), and so we haven’t included it here.

Remove Meta Boxes from Pages

The same can be done for Pages, of course. Here’s the code for that.

Remember that when you put this code in your functions.php file, it’s theme-specific. So if you change themes, you’ll need to do it for that functions file too.

If you would like to make your own simple plugin for this code, you can learn how to do that here.

Щелкните ниже, чтобы поставить оценку!
Всего: 0 В среднем: 0

Написать комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *