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 Built from https://develop.svn.wordpress.org/trunk@56478 git-svn-id: http://core.svn.wordpress.org/trunk@55990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c9c4cf7b02
commit
9bb4defc3e
|
@ -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 ) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.4-alpha-56477';
|
||||
$wp_version = '6.4-alpha-56478';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue