Skip to content

Instantly share code, notes, and snippets.

@bigdigital
Last active February 16, 2017 13:52
Show Gist options
  • Save bigdigital/e5a3e194333060ce7b15f478ab04d877 to your computer and use it in GitHub Desktop.
Save bigdigital/e5a3e194333060ce7b15f478ab04d877 to your computer and use it in GitHub Desktop.
Change logout url in the7 theme
//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