Change Logout Redirect URL?

in Download Manager Free

Viewing 3 posts - 1 through 3 (of 3 total)
Oct 5, 2018 at 7:12 pm
#87803
Member
Wapiti
OP

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.

Oct 7, 2018 at 2:13 pm
#87860
Moderator
Shahriar
Staff

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();
}
Mar 13, 2020 at 9:43 pm
#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.