I have a custom post type menu called "Notes". It has two basic sub menus: add new and show all.

But I want to add more items under these post type but the default array just gave me these. How can I add unlimited items?

I'm tired searching, but no result...


First of all, searching with wrong keyword won't give you any right solution. It's a hint that, you are dealing with Admin menu, and anything under a menu drop down is called a sub menu - so you should search with something like: How to add submenu to any admin menu item + WordPress?. :)

Anyways, you have a wrong concept like adding Unlimited sub menu under a Custom Post Type - though you can (may) do it - but that would be irrelevant if that doesn't match with the purpose of that post type (CPT).

Now come to your question:

So in your case the code can be:

function register_my_custom_submenu_page()
   'edit.php?post_type=notes', //parent menu slug
   'New Page Title', //menu page title
   'New Menu Title',   //menu title
   'edit_posts', // capability
   'new_menu_slug', //menu slug/unique ID
   'submenu_callback' //callback function

add_action('admin_menu', 'register_my_custom_submenu_page');

/* Callback Function */
/* It will be visible when you will click the sub menu */
function submenu_callback() {
   echo '<h2>HERE IS WHAT MY PAGE IS ABOUT</h2>';
   echo '<p>Here is what my page says</p>';
  • thanks for your great advices .. i have tired to search with to many word's ... your answer help me thx again ... best regards ... so what if i want to show the content that exported from Note type post in the submenu page ?? – Azmy Feb 17 '14 at 7:04
  • :) That's a different question. Try more searching... :) and $wpdb or WP_Query() may help you. Good luck. – Mayeenul Islam Feb 17 '14 at 7:10

Try this..

function my_cpt_extra_menus() {
    //Add Submenu Page
    add_submenu_page( 'edit.php?post_type=my_cpt', 'Submenu Page Title', 'Menu Title', 'manage_options', 'slug_for_this_menu', 'function_to_output_html' );
add_action( 'admin_menu', 'my_cpt_extra_menus' );
  • thx v.match it's work :D – Azmy Feb 17 '14 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.