ure_show_front_end_menu_item
filter belongs to Front-end menu access add-on and allows to hide front-end menu item checking custom conditions, like current user name, role, etc. Look at the example below, which hides menu item with title ‘My Account’ from user with ‘subscriber’ role:
function _ure_show_front_end_menu_item($show, $menu_item, $restriction) { if ( $menu_item->title=='My Account' ) { $user = wp_get_current_user(); if ( is_a( $user, 'WP_User' ) && in_array( 'subscriber', $user->roles ) ) { $show = false; } } return $show; } |