Skip to content

Commit

Permalink
Switch to a core helper
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparsd committed Sep 18, 2024
1 parent 72ee3e0 commit 86bc007
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions class-two-factor-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,23 +182,8 @@ public static function uninstall() {
}
}

/**
* Get all user IDs to delete their user meta.
*
* Consider replacing this with a direct SQL query to speed up the process.
*/
$user_ids = get_users(
array(
'blog_id' => 0, // Return all users.
'fields' => 'ID',
'number' => -1, // This might take a while on larger sites but we have only one uninstall hook to run this.
)
);

foreach ( $user_ids as $user_id ) {
foreach ( $user_meta_keys as $meta_key ) {
delete_user_meta( $user_id, $meta_key );
}
foreach ( $user_meta_keys as $meta_key ) {
delete_metadata( 'user', null, $meta_key, null, true );
}
}

Expand Down

0 comments on commit 86bc007

Please sign in to comment.