Last active
February 16, 2017 13:52
-
-
Save bigdigital/e5a3e194333060ce7b15f478ab04d877 to your computer and use it in GitHub Desktop.
Change logout url in the7 theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add this to your functions.php of main or child theme | |
add_filter( 'logout_url', 'custom_logout_url',10, 2 ); | |
function custom_logout_url( $logout_url, $redirect ) | |
{ | |
//Uncomment one of theese return statements | |
//1.link to current page | |
$args = array( 'redirect_to' => get_permalink() ); | |
//link to static logout page (set your URL here) | |
//$args 'http://example/my-account/customer-logout/'; | |
if ( !empty($redirect) ) { | |
$args['redirect_to'] = urlencode( $redirect ); | |
} | |
$logout_url = add_query_arg($args, $logout_url); | |
return $logout_url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment