0

To check if a menu exists, I use this:

if ( isset ( $GLOBALS['admin_page_hooks']['menu-slug'] ) ){}

But it doesn't work with submenus.

How can I do the same for submenus then?

Thank you.

EDIT:

I also tried:

global $submenu;

if (isset($submenu['mymenu-slug']) && in_array('mysubmenu-slug', wp_list_pluck($submenu['mymenu-slug'], 2))) 
    {$test=1;}
else
    {$test=0;}

$test remains equal to 0.

2

Your Answer

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

Browse other questions tagged or ask your own question.