Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to logout via url at wordpress?

Tags:

wordpress

I have to logout user at wordpress where top bar is disabled and no logout option is available at any page.

Is there a general link to logout from wordpress?

like image 599
VeeZ Phone Avatar asked Aug 20 '17 09:08

VeeZ Phone


2 Answers

/wp-login.php?action=logout

Is what was used in the past.

References:

https://codex.wordpress.org/Function_Reference/wp_logout_url https://developer.wordpress.org/reference/functions/wp_logout_url/

like image 170
Enoch Avatar answered Sep 22 '22 08:09

Enoch


I think the better method is to get the nonce and redirect to the home page:

<a href="<?php echo wp_logout_url( home_url()); ?>" title="Logout">Logout</a>
like image 40
Platoscave Avatar answered Sep 19 '22 08:09

Platoscave