[wp-trac] [WordPress Trac] #59212: Call `add_user_meta()` when adding metadata to a new user

WordPress Trac noreply at wordpress.org
Sun Aug 27 12:14:45 UTC 2023


#59212: Call `add_user_meta()` when adding metadata to a new user
-------------------------+-----------------------------
 Reporter:  johnbillion  |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Users        |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  performance
-------------------------+-----------------------------

Comment (by johnbillion):

 Testing steps:

 * Call `wp_insert_user()` with at least `user_login` and `user_email`
 provided.
 * Confirm that all default meta fields are correctly inserted (several
 have an empty value by default):
    - `nickname`
    - `first_name`
    - `last_name`
    - `description`
    - `rich_editing`
    - `syntax_highlighting`
    - `comment_shortcuts`
    - `admin_color`
    - `use_ssl`
    - `show_admin_bar_front`
    - `locale`
 * Repeat with a `meta_input` field included to include custom user meta
 fields

 The `test_wp_insert_user_with_meta()` test covers this functionality and
 is sufficient for confirming that user meta data is saved when a user is
 created.

 Database queries:

 Before this change: 54
 After this change: 43

 As expected, this saves 11 database queries, one for each of the default
 meta values stored with every user.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59212#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list