• Resolved mercuryfenix

    (@mercuryfenix)


    I would like to log the user out and redirect to the home page instead of ending up on the wp-login page. Is this possible? How?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter mercuryfenix

    (@mercuryfenix)

    bump

    t31os

    (@t31os)

    Not without modding core files no, or at least not with ease.

    wp-login.php

    Starting line 274…

    case 'logout' :
    	check_admin_referer('log-out');
    	wp_logout();
    
    	$redirect_to = 'wp-login.php?loggedout=true';
    	if ( isset( $_REQUEST['redirect_to'] ) )
    		$redirect_to = $_REQUEST['redirect_to'];
    
    	wp_safe_redirect($redirect_to);
    	exit();
    
    break;

    You could modify the redirect, but you’ll have to do this with each update of WordPress.

    Thread Starter mercuryfenix

    (@mercuryfenix)

    that will have to do. its not too hard. it would be ideal to make a parameter in the loginout function to send it to this…

    fUzZy89

    (@fuzzy89)

    Before this code worked:

    <a href="<?php bloginfo('url') ?>/wp-login.php?action=logout&amp;redirect_to=<?php echo urlencode($_SERVER['REQUEST_URI']) ?>">Logg ut</a>

    I tried this now, but it does not work anymore, why?

    MichaelH

    (@michaelh)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘log user out’ is closed to new replies.