Just write a if condition for do this..Example
if(Auth::user()->has('Affiliate')) {
<a href="/affiliate-dashboard">Affiliate Dashboard</a>
}
But it's only possible when your user have assigned specific role
The following code will hide "Affiliate Dashboard" menu item if the current user role is not "affiliate":
The code:
add_action( 'wp_head', 'show_hide_affiliate_menu_item', 500 );
function show_hide_affiliate_menu_item() {
if( ! current_user_can( 'yith_affiliate' ) )
echo '<style> .top-bar-nav #menu-item-11874 { display: none !important } </style>';
}
Code goes in function.php file of your active child theme (or active theme). It should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.