Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Have multisite set up and would like to redirect users on logout to the root site home page. I know there has to be an answer for this. But I can't find it! driving me batty;-) Any help greatly appreciated.

share|improve this question

3 Answers 3

you can use wp_logout_url( $redirect); as Pippin sugested if you are echoing out the logout link and if you need it for the built-in logout link on the backend you can use:

//function to redirect after logout
function logout_redirect765(){
  wp_redirect( home_url() ); 
  exit; 
}

//hook function  to wp_logout action
add_action('wp_logout','logout_redirect765');
share|improve this answer
    
+1 This will handle logic based redirection –  Ashfame May 8 '11 at 14:55

use wp_logout_url( $redirect ); $redirect is the url for them to be redirected to.

share|improve this answer
    
geeezzz thanks. I had tried that before - but in the wrong spot... worked like a charm! –  Ann Jan 31 '11 at 15:05

You can probably accomplish what you need to with wp_logout_url( $redirect ). I'd try replacing the logout link in your theme's template files with something like this:

<a href="<?php echo wp_logout_url( network_home_url() ); ?>" title="Logout">Logout</a>

There's not a codex page for network_home_url(), but there is one for home_url(), and it mentions using network_home_url() for a multisite install.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.