How To Add Multiple Custom Post Types Under One Menu Section

Custom Post Types are awesome! They make it insanely easy to add and manage contents.

Whether you’re developing a theme or creating a WordPress site, there’s a very good chance that you’ll end up creating few custom post types. I always do.

Multiple Custom Post Types under one menu section

Recently, I developed a custom theme and as usual I added few custom post types. And I felt it’d be actually a good idea if I could have them under one menu section. That way it’s more organized and specific.

So, here I’ll be sharing how you can add multiple custom post types under one menu section.

Add Multiple Custom Post Types Under One Menu Section

Basically, what we’ll do is – we’ll create a menu item using the add_menu_page() function. Then, we’ll add our custom post types under that menu item. Simple as that.

Let’s break it down, so it’s easier and clearer for you.

Creating the Menu Item

add_menu_page() function takes seven parameters. These parameters are –

  1. Page Title – this will be shown in the title tags of the page when menu item is selected. We used ‘Front Sections’ as the title.
  2. Menu Title – the title that will be shown on the dashboard menu. Here, we used ‘Front Sections’ as the menu item title.
  3. Capability – what users are able to do with this menu item. We don’t want to add any page or options to manage. So here, we used ‘read’.
  4. Menu Slug- the slug name to refer to this menu item. This should be unique. Here, we used ‘front-sections’.
  5. Function – function to output content for this page. Since, we are not actually creating a page, we’ll just leave it blank.
  6. Icon – this can add a nice little icon to our menu item. You can use one from WordPress Dashicons.
  7. Position – this determines the position of the menu item in dashboard menu order. If you don’t know where to add your menu item check this.

Finally, we used the ‘admin_menu‘ action to add our menu item to admin panel’s menu structure.

Now that we have added our menu item let’s see how to add our custom post types to this menu item.

Adding Custom Post Type Under Menu Item

This is a function to register a custom post type in WordPress. Here, I will not go into details on how you can register a custom post type or what controls you can have.

Other details doesn’t matter to us now. What matter is the ‘show_in_menu’ argument. If you notice we used ‘front-sections’ for this argument. ‘front-sections’ is the menu slug of the menu item we created previously.

When we set this as the ‘show_in_menu’ argument, WordPress adds the custom post type under the mentioned menu item.

I’ve added few custom post types under one menu section. Here’s how it looks


You can add any numbers of custom post type under the menu item using the ‘show_in_menu’ argument. It’s as simple as that.

Over to You

If you didn’t know, now you know how you can add multiple custom post types under one menu item or section. I hope you find this helpful.

If you have any questions or suggestions, feel free to share them through comments.

Click Here to Leave a Comment Below

Mizanur Rahaman Mizan

One of the best article written by you. Proud of you. Keep continue

Sadhan Pal

Will you please tell me, am I able to write html tags into wordpress template which built in php?

    Imtiaz Rayhan

    Hi Sadhan,

    Yes you can write HTML tags in PHP. You just have to drop out of the PHP using the closing tag and start writing PHP again using the opening tag. You can also output HTML tag using ‘echo’ in PHP.

    Thank you.

Leave a Reply: