mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-30 23:30:05 +00:00
Users: Call add_user_meta() instead of update_user_meta() when adding metadata to a new user.
This improves the performance of inserting users as it removes one unnecessary `SELECT` query for every row of metadata inserted. Props swissspidy, spacedmonkey, johnbillion Fixes #59212 git-svn-id: https://develop.svn.wordpress.org/trunk@56478 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2431,9 +2431,16 @@ function wp_insert_user( $userdata ) {
|
||||
|
||||
$meta = array_merge( $meta, $custom_meta );
|
||||
|
||||
// Update user meta.
|
||||
foreach ( $meta as $key => $value ) {
|
||||
update_user_meta( $user_id, $key, $value );
|
||||
if ( $update ) {
|
||||
// Update user meta.
|
||||
foreach ( $meta as $key => $value ) {
|
||||
update_user_meta( $user_id, $key, $value );
|
||||
}
|
||||
} else {
|
||||
// Add user meta.
|
||||
foreach ( $meta as $key => $value ) {
|
||||
add_user_meta( $user_id, $key, $value );
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( wp_get_user_contact_methods( $user ) as $key => $value ) {
|
||||
|
||||
Reference in New Issue
Block a user