WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Logout Redirect not working (4 posts)

  1. webfrogs CREATIVE AGENCY
    Member
    Posted 11 months ago #

    The main site is located here.

    When I'm logged in (as an Admin), and then try to logout, it redirects me here, which is the location where the above site was developed before being migrated.

    I've tried a couple different redirect plugins (specifically Theme My Login and Peter's Login Redirect), but they're proving to be insufficient.

    I have the .htaccess file open, but don't see any way to isolate the redirect on logout.

    Can I get some help please?

    Regards,

    Jared

  2. lettergrade
    Member
    Posted 11 months ago #

    Not sure myself, but does this help?

  3. webfrogs CREATIVE AGENCY
    Member
    Posted 11 months ago #

    @lettergrade - That worked perfectly. Reposting here for convenience.

    If you want to go directly to the frontpage when you logout, place this into your functions.php in your current theme directory:

    add_action('wp_logout','go_home');
    function go_home(){
      wp_redirect( home_url() );
      exit();
    }

    Make sure you post it beneath this line...

    <?php if (!is_admin()) if(!session_id()) session_start();

  4. lettergrade
    Member
    Posted 11 months ago #

    Sweet!

Reply

You must log in to post.

About this Topic