wordpress redirect on logout

admin

Administrator
Staff member
I have a logout link on my wordpress page.

Here's the code:

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 ?