How to automatically redirect to current page after logout

By default after user log out WordPress, user will be redirect to the login page. This useful trick that allow you to stay on current page after logout of your WordPress website.

Adding following snippet to current theme’s functions.php file:

Above snippet  works only on non-admin pages. To make this work on any page you should replace:

with

If you have any questions or comments, please feel free to comment below. Also, if you have better ideas, do share your thoughts, I would be happy to expand my knowledge.

Leave a Reply

Your email address will not be published. Required fields are marked *