I need to log out the logged in user through the URL without going to log-in page or log out confirmation.Is it possible?
For example:
I am taking the URL mysite.com/testpage?logout=1
. If the logout parameter is available in URL i need to log out the user without any log out confirmation and go to the mysite.com/testpage
page is it possible?
please suggest any option for this
thanks in advance
You’re looking for WordPress’s get_query_var(). For example, you could define a function such as the following:
you can use the
wp_logout_url()
function.Example:
Please use this following code :
Hope it will work for you.