注销/登录重定向CSS问题

时间:2013-01-31 作者:M3o

我正在使用WordPress多站点。当我使用wp_logout_url(), 我被重定向到登录页面,但不知何故,我在另一个登录页面结束,没有应用任何样式

   <a href="<?php echo wp_logout_url(); ?>" title="Logout">Logout</a>
这是我调用的唯一注销函数。

我的登录功能如下所示:

  // 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\');

} 
我想我需要将函数1和2应用于wp_logout_url() 函数以应用CSS。我已经试了很久了。

登录页面:

Login page with css applied before login

当我注销时,我会看到下一个屏幕截图:

enter image description here

正在重定向到的注销/登录页面:

Login/logout without stylesheet applied

如果有人能解释或让我走上正确的道路,我将不胜感激。

NOTE:

登录链接:

/wp-login.php?redirect_to=http%3A%2F%2Fdesignmobile.se%2Fgomobile%2Fkrisdemo%2Fwp-admin%2F&reauth=1
注销链接:。

/wp-login.php?action=logout&redirect_to=http%3A%2F%2Fdesignmobile.se%2Fgomobile%2Fkrisdemo%2F&_wpnonce=17d70b468f

1 个回复
最合适的回答,由SO网友:kallekillen 整理而成

如果要重定向到当前正在使用的页面:

wp_logout_url( $_SERVER[\'REQUEST_URI\'] );

wp_logout_url( get_permalink() );
或者,如果要重定向到其他站点,请使用allowed_redirect_hosts 作用

结束