Change Logout Redirect URL?

Viewing 3 posts - 1 through 3 (of 3 total)
#87803

Wapiti
Member

Logout currently takes me to a non-existant 404 page. I would like to change that to the home page. I tried creating a 301 redirect but that’s not technically right and it also doesn’t actually log me out if I do that.

#87860

Shahriar
Moderator

Add the following code to the bottom of your active theme’s functions.php file to redirect users to the homepage. You can add custom URL slug inside home_url function to redirect to a custom URL.

add_action('wp_logout', 'wpdm_logout_redirect');
function wpdm_logout_redirect(){
    wp_redirect(home_url(""));
    exit();
}
#121971

Thank you – this is just what I was after:

add_action('wp_logout', 'wpdm_logout_redirect');
function wpdm_logout_redirect(){
    wp_redirect(home_url(""));
    exit();
}
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Change Logout Redirect URL?’ is closed to new replies.