Filter hook 'logout_redirect'

in WP Core File wp-login.php at line 831

View Source

logout_redirect

Filter Hook
Description
Filters the log out redirect URL.

Hook Information

File Location wp-login.php View on GitHub
Hook Type Filter
Line Number 831

Hook Parameters

Type Name Description
string $redirect_to The redirect destination URL.
string $requested_redirect_to The requested redirect destination URL passed as a parameter.
WP_User $user The WP_User object for the user that's logging out.

Usage Examples

Basic Usage
<?php
// Hook into logout_redirect
add_filter('logout_redirect', 'my_custom_filter', 10, 3);

function my_custom_filter($redirect_to, $requested_redirect_to, $user) {
    // Your custom filtering logic here
    return $redirect_to;
}

Source Code Context

wp-login.php:831 - How this hook is used in WordPress core
<?php
 826  		 *
 827  		 * @param string  $redirect_to           The redirect destination URL.
 828  		 * @param string  $requested_redirect_to The requested redirect destination URL passed as a parameter.
 829  		 * @param WP_User $user                  The WP_User object for the user that's logging out.
 830  		 */
 831  		$redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user );
 832  
 833  		wp_safe_redirect( $redirect_to );
 834  		exit;
 835  
 836  	case 'lostpassword':

PHP Documentation

<?php
/**
		 * Filters the log out redirect URL.
		 *
		 * @since 4.2.0
		 *
		 * @param string  $redirect_to           The redirect destination URL.
		 * @param string  $requested_redirect_to The requested redirect destination URL passed as a parameter.
		 * @param WP_User $user                  The WP_User object for the user that's logging out.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-login.php
Related Hooks

Related hooks will be displayed here in future updates.