Skip to content

Commit

Permalink
Redirect to referrer on log out with optional filter
Browse files Browse the repository at this point in the history
  • Loading branch information
kimcoleman committed Sep 12, 2022
1 parent 6ec0a5b commit c685c15
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,14 @@ function memberlite_login_redirect_to() {
return apply_filters( 'memberlite_login_redirect_to', esc_url( $redirect_to ) );
}

/* Get the redirect_to URL to use for "Log Our" links. */
/* Get the redirect_to URL to use for "Log Out" links. */
function memberlite_logout_redirect_to() {
return apply_filters( 'memberlite_logout_redirect_to', home_url() );
if ( isset( $_SERVER['REQUEST_URI'] ) ) {
$redirect_to = home_url( esc_url( $_SERVER['REQUEST_URI'] ) );
} else {
$redirect_to = home_url();
}
return apply_filters( 'memberlite_logout_redirect_to', esc_url( $redirect_to ) );
}

/* Adds a Log Out link in member menu */
Expand Down

0 comments on commit c685c15

Please sign in to comment.