Redirect to homepage after logout
When wp_logout_url function is called without a $redirect value this function will help. You can also redirect to a different url or website. Check out the wp_redirect arguments.
/** * Snippet Name: Redirect to homepage after logout * Snippet URL: https://wpcustoms.net/snippets/redirect-homepage-logout/ */ function wpc_auto_redirect_after_logout(){ wp_redirect( home_url() ); exit(); } add_action('wp_logout','wpc_auto_redirect_after_logout');