Home › Forums › Ultra Community › How-To and Troubleshooting › logout is redirecting to profile page and not in home page. › Reply To: logout is redirecting to profile page and not in home page.
July 8, 2019 at 4:22 pm
#12434

MihChe
Keymaster
Hi,
You can use the below snippet to redirect them to home page. Add the code into your theme or child theme functions.php file
if(class_exists('\UltraCommunity'))
{
add_action( 'wp_loaded', function () {
if(!is_user_logged_in() || is_admin() || empty($_GET['uc-action']) || $_GET['uc-action'] !== 'logout')
return;
\UltraCommunity\MchLib\Utils\MchWpUtils::logOutCurrentUser(home_url());
});
}