Tag Archives: filter

display menu item only for registered user

functions.php

add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
function add_loginout_link( $items, $args ) {
if (is_user_logged_in() && $args->theme_location == 'primary') {
$items .= '<li><a href="'.get_permalink(74939).'">Documents</a></li>';
}
return $items;
}

%d bloggers like this: