Make WordPress Core


Ignore:
Timestamp:
05/24/2021 07:58:13 PM (4 years ago)
Author:
desrosj
Message:

General: Avoid unnecessary calls to update_user_option().

The update_user_option() function is a way to update a user meta value after adding a blog’s prefix to the beginning of the meta key. But when the fourth parameter is true, the behavior is exactly the same as calling update_user_meta() directly.

This replaces all instances of update_user_option() when the fourth parameter is true in Core with a direct call to update_user_meta() to prevent an unnecessary call to update_user_option().

Props johnjamesjacoby, zkancs, obenland, desrosj.
Fixes #43339.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/my-sites.php

    r47785 r50981  
    2828    $blog = get_site( (int) $_POST['primary_blog'] );
    2929    if ( $blog && isset( $blog->domain ) ) {
    30         update_user_option( $current_user->ID, 'primary_blog', (int) $_POST['primary_blog'], true );
     30        update_user_meta( $current_user->ID, 'primary_blog', (int) $_POST['primary_blog'] );
    3131        $updated = true;
    3232    } else {
Note: See TracChangeset for help on using the changeset viewer.