Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #377005

    Hi, everybody!

    I want to put a logout button or link in the top menu.

    I’ve searched the wordpress.org site but I didn’t see clearly the way to do it.

    When I tried to get a logout & redirect to homepage link putting <a href="<?php echo wp_logout_url( home_url() ); ?>" title="Logout">Logout</a> in the WP menu url field, and click Save Menu, the Menu rewrite ahref and become useless.

    Then, I found this as example and I think that I have to put it in enfold-child theme functions

    add_filter('allowed_redirect_hosts','allow_ms_parent_redirect');
    function allow_ms_parent_redirect($allowed)
    {
        $allowed[] = 'multisiteparent.com';
        return $allowed;
    }
    
    <a href="<?php echo wp_logout_url( 'http://multisiteparent.com' ); ?>" title="Logout">Logout</a>

    How can I get it?

    Thanks!

    Best regards!

    #377127

    Affaire solved with one plugin that works perfectly, at least for me. Share for people with the same question:

    https://wordpress.org/plugins/baw-login-logout-menu/

    Gracias

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Logout button or link in the top menu’ is closed to new replies.