diff --git a/inc/admin/class-flash-theme-review-notice.php b/inc/admin/class-flash-theme-review-notice.php index d856a74..e8d0221 100644 --- a/inc/admin/class-flash-theme-review-notice.php +++ b/inc/admin/class-flash-theme-review-notice.php @@ -182,7 +182,6 @@ public function ignore_theme_review_notice_partially() { * Remove the data set after the theme has been switched to other theme. */ public function review_notice_data_remove() { - $get_all_users = get_users(); $theme_installed_time = get_option( 'flash_theme_installed_time' ); // Delete options data. @@ -190,21 +189,11 @@ public function review_notice_data_remove() { delete_option( 'flash_theme_installed_time' ); } - // Delete user meta data for theme review notice. - foreach ( $get_all_users as $user ) { - $ignored_notice = get_user_meta( $user->ID, 'flash_ignore_theme_review_notice', true ); - $ignored_notice_partially = get_user_meta( $user->ID, 'nag_flash_ignore_theme_review_notice_partially', true ); - - // Delete permanent notice remove data. - if ( $ignored_notice ) { - delete_user_meta( $user->ID, 'flash_ignore_theme_review_notice' ); - } - - // Delete partial notice remove data. - if ( $ignored_notice_partially ) { - delete_user_meta( $user->ID, 'nag_flash_ignore_theme_review_notice_partially' ); - } - } + // Delete user meta data for theme review notice, for every user in + // one query per key - avoids loading every user on the site just to + // unconditionally delete a key that either exists or doesn't. + delete_metadata( 'user', 0, 'flash_ignore_theme_review_notice', '', true ); + delete_metadata( 'user', 0, 'nag_flash_ignore_theme_review_notice_partially', '', true ); } }