Hey! I have added a wp_loginout() to my header using a snippet in my functions.php:
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
function add_login_logout_link($items, $args) {
ob_start();
wp_loginout('index.php');
$loginoutlink = ob_get_contents();
ob_end_clean();
$items .= '<li>'. $loginoutlink .'</li>';
return $items;
}
The thing is that it shows the login link in every one of my three menues:
function register_main_menus() {
register_nav_menus(
array(
'primary-menu' => __( 'Primary Menu' ),
'secondary-menu' => __( 'Secondary Menu' ),
'footer-menu' => __( 'Footer Menu' ),
)
);
};
I would like to target the wp_nav_menu_items filter to only include the login link in the primary menu. Ideas? Thanks in advance