I said LogOUT, dangnabbit

Don’t tell Tall Andy, but Croila has been working me hard this afternoon, in spite of my clearly being at death’s door *ahem*.

Well, not that hard, really. All I was doing was clarifying a code snippet I’d suggested she use. Actually it was hardly work at all.

Anyway, testing that what I’d suggested actually worked involved logging in and out of a blog quite a few times and it started to irritate me that clicking “Logout” or “Sign Out” (from the admin screens) was taking me to the login screen (hence the title for this post).

Fixing this is a piece of cake1.

It involves the teeniest of hacks to your wp-login.php file. Just change the ‘wp-login.php’ in row 30 of the code to (that’s two single quotes, by the way).

i.e. from:

case 'logout':
wp_clearcookie();
do_action('wp_logout');
nocache_headers();
$redirect_to = 'wp-login.php';
if ( isset($_REQUEST['redirect_to']) )

to:

case 'logout':
wp_clearcookie();
do_action('wp_logout');
docache_headers();
$redirect_to = '';
if ( isset($_REQUEST['redirect_to']) )

Now when you logout you really do log out.

Incidentally, you can apply the same logic in row 172 for when people log in - change

	$redirect_to = 'wp-admin/';

to

	$redirect_to = 'wp-admin/post.php';

for example, to take users straight to the new post screen.

1 Mmmmm … cake - I must be feeling better.

 

One response


  1. Ladies and gentlemen, I give this my personal stamp of approval! It WORKS! Now is Em a genius or what?

Leave a Reply