WP Loginout Link Menu

Before you proceed to add WP loginout link in WP Menu, I will recommend you for using WordPress Child Theme.  If you are new to wordpress and learning WordPress tweaking then WP child theme is best for you to avoid disaster.

Add WP loginout link in WP Menu

  1. Open wordpress child theme functions.php file
  2. Copy and paste this below codes in functions.php file
    /*==========================================    
        Add LogIn/LogOut Link in Menu
    ===========================================*/
        
        function add_login_logout_link($items, $args) { 
        $loginoutlink = wp_loginout('index.php', false); 
        $items .= '<li>'. $loginoutlink .'</li>'; 
        return $items; 
        }
        add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
    
  3. And save it.

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve : *
20 × 11 =