I'm using WordPress Multisite. When I use wp_logout_url(), I get redirected to the login page but somehow I end at a different login page without any styles applied

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

That's the only logout function I'm calling.

And my login functions look like this:

  // 1. Custom login CSS
function my_login_stylesheet() { ?>
<link rel="stylesheet" id="custom_wp_admin_css"  href="<?php echo get_bloginfo( 'stylesheet_directory' ) . '/style.css'; ?>" type="text/css" media="all" />
<?php }
add_action( 'login_enqueue_scripts', 'my_login_stylesheet' );

// 2. Change logo URL
add_filter('login_headerurl', 'my_custom_url');
function my_custom_url(){
return "http://mydomain.com/domain";

// 3. Add personal message to login

function custom_login_message() {
$message = '<p class="message">KOMM - App</p>';
return $message;
add_filter('login_message', 'custom_login_message');

// 4. Change login button text

add_action( 'login_form', 'wpse17709_login_form' );
function wpse17709_login_form()
    add_filter( 'gettext', 'wpse17709_gettext', 10, 2 );
function wpse17709_gettext( $translation, $text )
    if ( 'Log In' == $text ) {
        return 'OK';
    return $translation;

// 5. Redirect user to index-page after login
add_filter('login_redirect', 'plugin_admin_redirect'); 
function plugin_admin_redirect($redirect_to, $url_redirect_to = '', $user = null) { 
    return get_option('siteurl');


I guessing that I need to apply function 1 and 2 to the wp_logout_url() function to get the CSS applied. I've been trying for long now.

Login page:

Login page with css applied before login

And when I logout I get to next screenshot:

enter image description here

Logout/login page that I'm being redirected to:

Login/logout without stylesheet applied

I would appreciate if someone could explain or get me on the right path.


Login link:


Logout link:.

  • Are you sure a "redirect is involved at all? Looks like the same page with different, or missing, CSS.
    – s_ha_dum
    Jan 31, 2013 at 15:26
  • Yes its involved , see updated question. That happens when i click logout. Im not sure if im geeting redirected to another page or to the same page but no css applied.
    – M3o
    Jan 31, 2013 at 15:28
  • Yes, you do get redirected at logout but ordinarily the redirect sends you from wp-login.php to wp-login.php. What changes are the $_GET parameters. Are you at wp-login.php in both cases?
    – s_ha_dum
    Jan 31, 2013 at 15:41
  • No its not the same link really. 1. When someone is trying to reach the website , ull be redirected to wp-login (pic1) & (link1) 2.When you sign in and log out (pic2) & (link2). Question Updated again @s_ha_dum
    – M3o
    Jan 31, 2013 at 15:49
  • If same page but missing CSS , what is causing it ? @s_ha_dum
    – M3o
    Jan 31, 2013 at 15:50

1 Answer 1


If you want to redirect to the page you're currently on use:

wp_logout_url( $_SERVER['REQUEST_URI'] );


wp_logout_url( get_permalink() );

Or if you want to redirect to another site use the allowed_redirect_hosts function.

  • I just want when i logout ill get redirected to (pic1) again...
    – M3o
    Jan 31, 2013 at 15:56
  • Then try the above wp_logout_url( $_SERVER['REQUEST_URI'] ); or wp_logout_url( get_permalink() ); Jan 31, 2013 at 16:00
  • REQUEST_URI didnt work , same issue and get_permalink() dont allow me to logout.
    – M3o
    Jan 31, 2013 at 16:06
  • Did you have a look at the documentation above re: "allowed_redirect_hosts"? Jan 31, 2013 at 17:18
  • Yes ive tried it and its the same issue. Sems im being redirected to wordpress default login instead of my custom login. Its only a guess.
    – M3o
    Feb 4, 2013 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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