How to insert new values to WordPress user Firstname and Surname Fields via DB

If you have the ID of the user you can do this:

wp_update_user([
    'ID' => $userId, // this is the ID of the user you want to update.
    'first_name' => $firstName,
    'last_name' => $lastName,
]);

You can update / insert almost all fields with this function. Take a look at the documentation here

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)