Add Categories Under Posts or Pages in Wordpress Back Office Admin

Add Post Categories Under Posts in WordPress

Happy weekend to you all!

Ahead of adding another free tutorial this weekend I wanted to improve my WordPress back office. The library of Tutorials is getting bigger and currently I have to go into posts and filter them by post type to list the individual categories.

Which got me thinking: can I add post categories under ‘Post’ on the left-hand side in admin?. Being in SEO I managed to quickly find the answer to my question on this thread from 5 years ago. So glad the Internet keeps good records!

Here’s the code snippet and then I’ll show you how to add it to posts and pages (it’s slightly different):


function custom_posts_menu(){
 add_submenu_page('edit.php', 'HTML5', 'HTML5', 'manage_options', 'edit.php?category_name=html5' );
 add_submenu_page('edit.php', 'CSS3', 'CSS3', 'manage_options', 'edit.php?category_name=css3' );

function custom_pages_menu(){
 add_submenu_page('edit.php?post_type=page', 'HTML5', 'HTML5', 'manage_options', 'edit.php?category_name=html5' );
 add_submenu_page('edit.php?post_type=page', 'CSS3', 'CSS3', 'manage_options', 'edit.php?category_name=css3' );

add_action('admin_menu', 'custom_posts_menu');
add_action('admin_menu', 'custom_pages_menu');


You need to add this to your WordPress theme’s functions.php (or your Child Theme if you’re using one).

WordPress add_submenu_page() Function

The full spec for this function can be found on, but here’s a summary:

<?php add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function ); ?>
  • Parent Slug: To add a menu under posts the first variable of the add_submenu_page() function is just edit.php. To add your menu under Pages this needs to be edit.php?post_type=page This determines where in the menu it appears.
  • Page Title/Menu Title: The text to display on the page when you click through and the text on the menu itself.
  • Capability: No simple ‘catch all phrase for this’. The full list of capabilities is here but the one we want to add post categories under posts is manage_options.
  • Function: Where you want the link to go. In our case we want it to list posts (or pages) with a set category: edit.php?category_name=html5. This is the same for posts and pages.

Add Categories Under Posts in WordPress
You then just add the last line(s) so it triggers in the admin and you’re done. I’ve done two functions so you can add it to posts or pages.

My last note is just to make sure you know what your category slugs actually are before you write these functions. And also which categories you have in posts vs. pages. Your menu should then look something like the screen grab.

Hope this helps someone!

Spread the Word

Share This On Facebook Share This On Twitter Share This On Linkedin Share This On Google Plus Share This On Pinterest Share This On Mail

Martin Oxby

Martin Oxby has been building websites for many years, from simple coded ones to bespoke website software. He currently co-runs Summit Web Solutions based in Inverness, Scotland.