Satch3000
Satch3000

Reputation: 49384

wordpress redirect on logout

I have a logout link on my wordpress page.

Here's the code:

echo '<a href="http://mydomain.com/wp-login.php?action=logout&redirect_to='.urlencode($url_home).'&_wpnonce=a2b834fa87">Logout</a>';

When I click logout it still prompting me if I am sure to logout and after login out it's going to the login page.

How can I just get it to loggout and go to index.php ?

Upvotes: 0

Views: 1458

Answers (1)

jeffjenx
jeffjenx

Reputation: 17467

Why not use the built-in Wordpress functions:

<a href="<?php echo wp_logout_url( get_bloginfo('url') ); ?>&_wpnonce=a2b834fa87">Logout</a>

Upvotes: 2

Related Questions