Tagged: , ,

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #531722

    Hi there, can anyone help me with this? I see all posts before and after mine have been answered except mine.

    Thank you.



    I didn’t test your code out but just from looking at it you’ll need to change the “top-menu” part to point to our theme location names.

    You can change it to this to target the primary menu.

    if (is_user_logged_in() && $args->theme_location == 'avia') {

    Or switch it to “avia2” or “avia3” to target the header / footer menu areas.

    Best regards,


    Hi Elliott,

    Thanks for getting back to me. This is exactly what I was missing! Works perfectly now. Thank you.

    In case anyone else is trying to add sign in/sign out logic to their header that uses non WP default pages (like with a WooCommerce store) via the functions.php file, here’s the code:

    // Add Log in / log out links to top menu
    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 == 'avia2') {
            $items .= '<li><a href="your-domain/account/customer-logout/">Log Out</a></li>';
        elseif (!is_user_logged_in() && $args->theme_location == 'avia2') {
            $items .= '<li><a href="your-domain/account/">Log In</a></li>';
        return $items;

    This will add the links to the top menu in your theme. Just replace the URL’s with your own URL’s to your log in and log out pages.



    glad it’s working for you and thanks a lot for sharing!


Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Add Login / Log out links to top menu’ is closed to new replies.