0

I am having issue with admin menu in multisite environment. I have a menu called YRC Settings which has two sub-menus, YRC Global Settings (first on the list) and YRC Homepage Settings (second in the list).

I want to hide the second item keeping the first one visible, so that when admin/user hovers on the parent menu i.e. YRC Settings, the first one (YRC Global Settings) flies out and the second item should not at all appear.

I used remove_submenu_page( 'yrc_settings_page', 'yrc_home_settings_page' );, but this hides both the sub menus, meaning when I hover over YRC Settings parent menu I don't see any sub menu flying out!

But when I use the same approach in single installation mode, this works. What should I do? According to the requirement I must make the first item visible.

remove_submenu_page( 'yrc_settings_page', 'yrc_home_settings_page'); is used to hide the sub-menu which has the following URL: /wp-admin/admin.php?page=yrc_home_settings_page

  • Menu with both sub-menus visible

enter image description here

  • What I see when using remove_submenu_page(...)

enter image description here

  • What I require:

enter image description here

0

Ok, I was doing a mistake and glad that I found it! I was using admin_menu hook when it should be admin_init.

So the only change I had to make was: add_action('admin_init', 'restrict_admin_access_by_role', 999);

https://stackoverflow.com/questions/27137866/what-wordpress-hook-fires-first-admin-init-or-admin-menu

Hope this would help somebody like me as well!

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.