Return to the Main Site After Logging Out
Sends users to the network's main homepage when they log out from any site, giving the whole network one consistent exit point.
Opens WPIDE on
Code
if ( ! is_multisite() ) {
return;
}
add_filter( 'logout_redirect', function ( $redirect_to, $requested ) {
return $requested ? $redirect_to : network_home_url( '/' );
}, 10, 2 );
Notes
Change network_home_url( '/' ) to a specific page path if you prefer.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.