Wednesday, 4 September 2013

Wordpress Menu Targeting

Wordpress Menu Targeting

Okay so I'm building out a plugin that generates a list from the $menu and
possibly $submenu. I want to loop through that array and generate that
list by the menu_slug, but I cannot seem to figure out how to do that.
Essentially what my plugin does is it will have the menu title with a
checkbox next to it. Upon checking that box and hitting submit it will
remove that menu item from the admin menu on the left. Now I know I can
set it to if a certain user can edit menus then do a certain function.
Which is great but the removing part is where I am stuck.
remove_menu_page( 'link-manager.php' );
Is what i've been looking at but this only removes that specific menu
item. I'm thinking it would be some sort of loop that goes through the
menu and is kinda like
if ( !current_user_can( 'manage_options' ) ) { loop through menu and
generate the menu title with the input checkbox }

No comments:

Post a Comment