Action hook 'wp_logout'

in WP Core File wp-includes/pluggable.php at line 676

View Source

wp_logout

Action Hook
Description
Fires after a user is logged out.

Hook Information

File Location wp-includes/pluggable.php View on GitHub
Hook Type Action
Line Number 676

Hook Parameters

Type Name Description
int $user_id ID of the user that was logged out.

Usage Examples

Basic Usage
<?php
// Hook into wp_logout
add_action('wp_logout', 'my_custom_function', 10, 1);

function my_custom_function($user_id) {
    // Your custom code here
}

Source Code Context

wp-includes/pluggable.php:676 - How this hook is used in WordPress core
<?php
 671  		 * @since 1.5.0
 672  		 * @since 5.5.0 Added the `$user_id` parameter.
 673  		 *
 674  		 * @param int $user_id ID of the user that was logged out.
 675  		 */
 676  		do_action( 'wp_logout', $user_id );
 677  	}
 678  endif;
 679  
 680  if ( ! function_exists( 'wp_validate_auth_cookie' ) ) :
 681  	/**

PHP Documentation

<?php
/**
		 * Fires after a user is logged out.
		 *
		 * @since 1.5.0
		 * @since 5.5.0 Added the `$user_id` parameter.
		 *
		 * @param int $user_id ID of the user that was logged out.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 1
  • File: wp-includes/pluggable.php
Related Hooks

Related hooks will be displayed here in future updates.