Created
September 8, 2021 15:59
-
-
Save justingreerbbi/720e47f0204d70fa6097e0d6f639df1b to your computer and use it in GitHub Desktop.
Remove OAuth Access Tokens when a user logs out of WordPress
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
/** | |
* Remove all OAuth access tokens when a user logs out of the WordPress | |
* @param $user_id | |
*/ | |
function wo_example_destroy_authorizations( $user_id ) { | |
global $wpdb; | |
$wpdb->delete( "{$wpdb->prefix}oauth_access_tokens", array( "user_id" => $user_id ) ); | |
$wpdb->delete( "{$wpdb->prefix}oauth_refresh_tokens", array( "user_id" => $user_id ) ); | |
} | |
add_action( 'wp_logout', 'wo_example_destroy_authorizations' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment