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:
<?php
/*
Plugin Name: Redirect to Base URL on logout
Plugin URI: https://snippets.khromov.se/redirect-to-base-url-on-logout-in-wordpress
Description: Redirect to Base URL on logout
Version: 2015.01.11
Author: khromov
Author URI: https://snippets.khromov.se
License: GPL2
*/
add_action('wp_logout', function()
{
wp_redirect(get_home_url());
exit;
});
If you prefer, you can use the code block (without plugin header) directly in your themes functions.php file.