Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello there,

    Thank you for reaching out to us.

    In order to achieve that objective, add this function into the child theme’s functions.php file.

    add_filter( 'wp_nav_menu_items', 'sydney_child_add_logout_menu', 10, 2 );
    function sydney_child_add_logout_menu( $items, $args ) {
        if ($args->theme_location == 'primary') {
    			if(is_user_logged_in()){
            $items .= '<li class="top-search-menu"><a href="'.wp_logout_url('index.php').'">'.__('Log Out', 'sydney').'</a></li>';
    			}
        }
        return $items;
    }

    If you haven’t been running a child theme yet, you can download it here.

    I hope this reply helps.

    Regards,
    Kharis

    Thread Starter harryburns

    (@harryburns)

    I dont want to do that can I not just put that in custom css

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    This isn’t a CSS problem.

    Thread Starter harryburns

    (@harryburns)

    ive done it thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How do I add a log out option to the menu’ is closed to new replies.