• Hi,

    In an attempt to add login/logout to my menu, I’ve added this code to my function.php

    /* LogIn - LogOut */
    
    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;
    }
    
    /* LogIn - LogOut END */

    My problem is, that the login/logout now appears in both the page menu as well as the category menu.

    How do I make it appear only in the page menu?

    Help greatly appreciated thank you,

    Michael ??

    (https://www.buildinganonline.com/)

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Adding login/logout to thte menu’ is closed to new replies.