How to create login/log out menu link

Community Forums Forums General Discussion How to create login/log out menu link

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  Jamie Mitchell 1 year, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #37319

    Jamie Mitchell

    Hey all !

    Does anyone know how to create a login/log out link in the menu?

    when the user is NOT logged in, it should say “login”

    when the user IS logged in it should say “log out”

    when the user logs in it would redirect to a page, say a login page (where i’ll have the log in form)

    and when the user logs out, it might go to the home page, or a log out page.

    i think it is not that complicated to do, just can’t seem to work it out, i checked the wordpress codex for login redirects, and there is some info there, but couldn’t really get it together.

    I’m using Premise too

    LOTS of folks are trying to do this out there, so any help will be useful to many

    thanks in advance :)



    There’s already a shortcode for this which you can access using Genesis Simple Edits plugin.

    Otherwise you can add a custom link in your menu or echo the link to output in any Genesis hook location using a custom function.

    You can also echo the shortcode in the custom function


    Jamie Mitchell

    Thanks Brad

    i found this shortcode


    [footer_loginout redirect to ""]


    and added that via a function

    works great but if someone has a sec could they check i have done it right?


    // Add Login/out to primary nav
    add_filter(‘wp_nav_menu_items’,’my_item’, 11, 2);
    function my_item($items, $args) {

    if( is_admin() ||  $args->theme_location != ‘primary’ )
    return $items;

    $items .= ‘<li class=”right”>’ . do_shortcode(‘[footer_loginout redirect=""]‘) . ‘</li>';
    return $items;



    thanks again

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.