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:
And when I logout I get to next screenshot:
Logout/login page that I’m being redirected to:
I would appreciate if someone could explain or get me on the right path.
NOTE:
Login link:
/wp-login.php?redirect_to=http%3A%2F%2Fdesignmobile.se%2Fgomobile%2Fkrisdemo%2Fwp-admin%2F&reauth=1
Logout link:.
/wp-login.php?action=logout&redirect_to=http%3A%2F%2Fdesignmobile.se%2Fgomobile%2Fkrisdemo%2F&_wpnonce=17d70b468f
If you want to redirect to the page you’re currently on use:
or
Or if you want to redirect to another site use the allowed_redirect_hosts function.