I want to use another link for logout because I have /wp-admin/*
protected with htpassword. Is there a way to do this? Something like creating a custom page like site.com/logout
then use it as my new logout link?
Thanks!
I want to use another link for logout because I have /wp-admin/*
protected with htpassword. Is there a way to do this? Something like creating a custom page like site.com/logout
then use it as my new logout link?
Thanks!
You must be logged in to post a comment.
You can filter
'logout_url'
and return a custom value if you are in the admin area:I think you should add rewrite rule in your htaccess file like this.
This worked for me redirecting to the home page:
I found the solution here:
https://www.kmbytes.com/wordpress-logout-redirect-filter/
And it is working great!
Cheers!
Displays a link, which allows users to navigate to the Log In page to log in or log out depending on whether they are currently logged in.
A very interesting solution is to create a Page “Logout” and then create the template of it in main folder of your theme by file
page-{your-logout-slug}.php
. And here is the simplest code of this page.Add argument to
site_url()
of any slug or leave empty to be logged out to your home page. It’s good because by using any php code you can do many things before you will be logged out.