authentication_storage = $storage->get_authentication_storage(); $this->user_storage = $storage->get_user_storage(); $this->login_token_manager = $login_token_manager; $this->session = $session; } public function register_hook() { add_action( 'wp_login', [ $this, 'clean' ], 5 ); } /** * @throws DateTime_Creation_Exception */ public function clean() { if ( $this->user_storage->is_wp_user_set() ) { $this->login_token_manager->reset(); $this->session->destroy(); $authentication = $this->authentication_storage->get_authentication( $this->user_storage->get_user_id() ); if ( $authentication instanceof Authentication ) { $this->authentication_storage->close_authentication( $authentication ); } } } }