• Resolved antonop4u

    (@antonop4u)


    Hi, I’m working on my own function to update some user profile data using ajax.

    On the server-side, I’m using the WordPress function wp_update_user().

    When I update for example the display_name (in the wp_users table) everything goes smooth, I send My ajax (post) request, and I get the data I’m expecting in return and the display_name is updated.

    But when I update for example the first_name (in the wp_usermeta table), it updates the value on the table but then it seems to stop because I can’t get the data I’m expecting in return.

    The two functions are identical:
    for the display_name:

    
    $value = sanitize_text_field( $_POST['value'] );				
    
    wp_update_user( array( 'ID' => $user_id, 'display_name' => $value ) );
    
    $status = array(
    'status' => true,
    'meggase' => ''
    );
    

    for the first_name:

    
    $value = sanitize_text_field( $_POST['value'] );				
    
    wp_update_user( array( 'ID' => $user_id, 'first_name' => $value ) );
    
    $status = array(
    'status' => true,
    'meggase' => ''
    );
    

    does anyone has any idea why this may happen?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘wp_update_user() and then stops’ is closed to new replies.