This page redirects to an external site: https://developer.wordpress.org/reference/hooks/wp_logout/
The wp_logout action hook is triggered when a user logs out using the wp_logout() function. The action is executed after the wp_clear_auth_cookie() function call.
This hook is an action which means that it primarily acts as an event trigger, instead of a content filter. Basic usage is as follows:
<?php
function your_function() {
// your code
}
add_action( 'wp_logout', 'your_function' );
?>
For example, you could use it to delete a transient stored while user is logged in:
<?php
function clear_transient_on_logout() {
delete_transient( 'transient_name' );
}
add_action( 'wp_logout', 'clear_transient_on_logout' );
?>
This hook provides no parameters.
wp_logout is located in wp-includes/pluggable.php.