Hi Mas Ganank,
So if you want to redirect it to external (other) website, then please add this action in to your function.php
add_filter( 'logout_redirect', 'fed_custom_logout_external_url', 20, 3 );
function fed_custom_logout_external_url(){
return wp_safe_redirect('https://your_external_url.extension');
}
try this and let me know 🙂
Sorry, please update the function to
function fed_custom_logout_external_url(){
return esc_url('https://your_external_url.extension');
}
Ok thanks very much MAS Vinoth 🙂
Welcome.. please don’t hesitate to contact for any queries
hello, I’ve added this code to my function.php theme and it doesn’t seem to work
add_filter( 'logout_redirect', 'fed_custom_logout_external_url', 20, 3 );
function fed_custom_logout_external_url(){
return esc_url('https://www.mydomain.com');
}
please check if there is an error?
or the file function I mean is wrong
Hi Mas,
Sorry for my previous code, Please remove those codes and add this below one in function.php. I have checked and its working, please let me know from your end 🙂
add_action('wp_logout','fed_redirect_to_external_after_logout');
function fed_redirect_to_external_after_logout(){
wp_redirect( 'https://google.com' );
exit();
}
thanks work well mas vinoth.
Glad to see it worked 🙂 Please never hesitate to contact us for any queries 🙂