3
votes

I have searched and searched and can't find another way other than what I will refer to as the 'hack method' to add a custom taxonomy to a custom admin menu.

add_menu_page(
        'Practice Directory',
        'Practice Directory',
        'read',
        'practice-directory',
        '',
        'dashicons-welcome-widgets-menus',
        40
);

Then I register my post types and make sure they use

'show_in_menu'          => 'practice-directory',

This works and the custom post types show in my custom menu.

But a custom taxonomy doesn't accept a string for the same property only true or false.

    'show_in_menu'          => 'false',

So to add it you have to create a submenu page

add_submenu_page(
    'practice-directory',
    'Doctors',
    'Doctors',
    'edit_posts',
    'edit-tags.php?taxonomy=doctor',
    false
);

Which is a 'hacked' way of doing it.

Is there another way? Without modifying the WordPress core could I overwrite register_taxonomy function to be able to accept a string for 'show_in_menu' and follow the functionality of the register_post_type?

requested screenshot

enter image description here

1
could you please show me some screenshot of your needs?developerme
@developerme not sure how to get you a screenshot of what I am looking for. If you understand what add_menu_page does and then the show_in_menu property of a custom post type does you would know that I am adding a menu item to the admin menu of WordPress. Then to add a custom taxonomy to that same menu it can't be done with the same property that is available when registering a custom taxonomy because it only accepts true or false, and not a string.Orlando P.

1 Answers

-2
votes

Go to appearance- > menu and find top of display screen option click on that and find what you need to show in menu