Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

Logout redirection

Simple Membership Plugin › Forums › Simple Membership Plugin › Logout redirection

Tagged: Logout, redirection

  • This topic has 9 replies, 6 voices, and was last updated 7 years, 3 months ago by mbrsolution.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • June 10, 2015 at 2:02 pm #2036
    StudioBizz
    Participant

    Hello,

    When user logout, he his redirected to the site Homepage. How can we redirect him to a specific page ?

    Thanks again 😉

    July 4, 2015 at 7:23 pm #2239
    uxpractice
    Participant

    **Bump** Looking for this exact solution. Have yet to dive into the code. Would rather have a scalable option (something in functions.php rather than hacking to plugin (for updating).

    I’m using the custom logout URL you’ve provided and looking to send (redirect) the user to login page after logging out. Any takers?

    July 6, 2015 at 11:17 am #2244
    StudioBizz
    Participant

    I am ! If you can find a way to do this, it would be wonderful !

    July 7, 2015 at 4:21 am #2253
    admin
    Keymaster

    You can use the following tweak to do a custom redirection after the logout event.

    Add the following code to your theme’s functions.php file and that should do the job:

    
    add_action('swpm_logout', 'my_custom_after_logout_redirection');
    function my_custom_after_logout_redirection()
    {
        $url = 'http://www.example.com/after-logout-page';//TODO - Specify the URL that you want to redirect to
        wp_redirect($url);
    }
    
    July 7, 2015 at 4:32 am #2257
    admin
    Keymaster

    You can add that code to a small custom plugin also (instead of your theme’s template file).

    January 5, 2016 at 9:06 pm #4774
    hwbmeuk
    Participant

    Hi Admin

    I have used your ‘add_action’ in my child theme and also (as a test – in the parent theme) – it doesn’t work in either place. Has there been an improvement in this code since July?

    Where is the original function managed, within the plugin? or can the logout URL be edited from the plugin admin interface?

    Dumping users at the home page is a bit frustrating for users if I have messages and content at the login page which are useful for the user.

    regards
    Howard

    January 6, 2016 at 1:13 am #4776
    mbrsolution
    Moderator

    Hi Howard try adding the following line exit(); at the end. That should work because I carried out a test with and with out that line. It definitely works with that line added.

    See the following code.

    add_action('swpm_logout', 'my_custom_after_logout_redirection');
    function my_custom_after_logout_redirection()
    {
        $url = 'http://www.example.com/after-logout-page';//TODO - Specify the URL that you want to redirect to
        wp_redirect($url);
        exit();
    }
    January 6, 2016 at 8:27 am #4779
    hwbmeuk
    Participant

    Brilliant.

    This worked perfectly … many thanks

    🙂

    July 26, 2018 at 9:26 am #15015
    sflosamuel
    Participant

    My website has 3 languages. I use wpml plugin.
    How can I redirect member to 3 languages index page respectively after logout?

    July 26, 2018 at 11:39 pm #15025
    mbrsolution
    Moderator

    Hi @sflosamuel, unfortunately at present there is no addon or integration with WPML plugin. If you are a developer, you might like to tweak the above code to improve the function to include other options when login out.

    Or you can also request for paid support.

    Regards

  • Author
    Posts
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2025 | Simple Membership Plugin | Privacy Policy