Useful Snippets


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at

RSS Latest posts from my personal blog

Most viewed posts

Subscribe to RSS feed

Redirect to base URL on logout in WordPress

Stanislav KhromovStanislav Khromov

After a user signs out, the default behaviour in WordPress is to send the user back to /wp-login.php

However, it’s usually more desired to send the user back to the base / root URL for their site. Here’s a small plugin that accomplishes exactly that:

Plugin Name: Redirect to Base URL on logout
Plugin URI:
Description: Redirect to Base URL on logout
Version: 2015.01.11
Author: khromov
Author URI:
License: GPL2
add_action('wp_logout', function()

If you prefer, you can use the code block (without plugin header) directly in your themes functions.php file.


Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
Twitter Profile
Visit my other blog

Comments 4