[resolved] WP 3.0 Login Logout redirect URL not working (6 posts)

  1. finzend
    Posted 4 years ago #

    Hi there,

    I'm using WP 3.0 and Buddypress. For a few months I'm having trouble redirecting users after logout. Wordpres ALWAYS goes to wp-login.php, no matter what. I've tried various things with the redirect parameter on wp_logout() and wp_logout_url() but nothing helps.

    Anybody having the same problems, or does somebody know a way to fix this?

  2. finzend
    Posted 4 years ago #

    Never mind, I found the solution!

    It was because of the Domain mapping plugin; that one messes with the logout/redirects.

    I've adjusted that plugin and now it works.

    Case closed.

  3. Michael Dance
    Posted 4 years ago #

    Care to share how you fixed it?

  4. finzend
    Posted 4 years ago #

    Offcourse! Sorry I didn't do that in the first place;)

    Go to domain_mapping.php
    Go to the function redirect_login_to_orig and replace it (or add the line with the redirect-if on logout)

    function redirect_login_to_orig() {
    	if ( !get_site_option( 'dm_remote_login' ) || $_GET[ 'action' ] == 'logout' || isset( $_GET[ 'loggedout' ] ) ) {
    		return false;
    	$url = get_original_url( 'siteurl' );
    	if ( $url != site_url() ) {
    		$url .= "/wp-login.php";
    		// finzend: make sure the redirect keeps working on logout?
    		if ( ($_GET[ 'action' ] == 'logout') && (!empty($_GET["redirect_to"])) )
    		  $url = $_GET["redirect_to"];
    		echo "<script type='text/javascript'>\nwindow.location = '$url'</script>";
  5. Michael Dance
    Posted 4 years ago #


  6. madivad
    Posted 4 years ago #

    Great find, this has been bugging me for a while! Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic