How To Remove A Themes Post Type With A WordPress Template

WordPress Tips and Solutions

Normally, we custom build every website that we take on, however we often help out smaller local companies. These smaller “mom and pop” shops tend to not have the budget for a giant custom website.

To encompass the budget cuts we have to build these sites using pre-built themes. Using themes allow us to build websites at an effective rate and then we are able to customize them!

One of the issues I was having with the Bazar Theme were the extra 6 post types that our client did not need. They wanted them removed because it was cluttering up the sidebar.

Please note if you use this trick to hide the fact that you are using a theme, that’s fine. Please, never put a purchased template into your portfolio and say you built the site! Don’t become another one of these statistics. Thanks!

So How Do I Remove The Post Types From A WordPress Purchased Theme?

Here is how I removed the pre-built post types using this code within the functions.php file.

Open up the themes fuctions.php and add the following code.

function hide_menu_items() {
remove_menu_page( 'edit.php?post_type=your-post-type-link' );
add_action( 'admin_menu', 'hide_menu_items' );

Keep in mind you can copy and paste this code as many times as needed to target multiple Default WordPress Theme Post Types you wish to remove:remove_menu_page( 'edit.php?post_type=your-post-type-link' );

Open up the backend of your WordPress theme and hover over the Post Type you want to remove. If you are using Google Chrome it will display the post types link at the bottom of the page.

Using Chrome you can right click the Post Type > Copy link address and paste it into remove_menu_page( 'edit.php?post_type=your-post-type-link' );

The great thing about this code is the fact that we actually did not remove the default theme Post Types. We only have these hidden and they can easily be switched back on! If you need one of them again all you have to do is remove the code from the function.php file. The Post Type will appear right where it was originally within the sidebar.

Hope this helps and if you have any other solutions, please comment below!

Matt Valvano

Author Matt Valvano

Matt has a very extensive experience of print and web design. He is an effective team player known for creativity, flexibility, distributing skills, managing, working with others and producing high quality, effective works of art within a deadline.

More posts by Matt Valvano
  • alandot spiders

    thank you for sharing this.

  • Awesome and neat and quick! Thank you 😀

  • Piet

    this merely hides the post types you don’t need, your site will still have the “bloat” and overhead that these slurp up, better to hook into the yit_unregister_post_types() function (line 469 of bazar/theme/functions-template.php)

  • I think the title of this post should be “How to remove a themes post type from dashboard menu”.

  • Marc Comish

    a slight modification to this, in order to do more than one you need to combine the remove_menu_page lines under a single hide_menu_item function like this:

    function hide_menu_items() {
    remove_menu_page( ‘edit.php?post_type=portfolio’ );

    remove_menu_page( ‘edit.php?post_type=service’ );

    remove_menu_page( ‘edit.php?post_type=team’ );

    remove_menu_page( ‘edit.php?post_type=testimonial’ );

    add_action( ‘admin_menu’, ‘hide_menu_items’ );

    • Marc Comish

      upon re-reading this i think the article does say that, the wording may have just confused me. either way, above is an example.

  • Ray Oluoch

    it helped, thank you.