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-includes/script-loader.php

    r50973 r50981  
    17901790    if ( $saved_ip_address && $current_ip_address && $current_ip_address !== $saved_ip_address ) {
    17911791        $saved_location['ip'] = $current_ip_address;
    1792         update_user_option( $user_id, 'community-events-location', $saved_location, true );
     1792        update_user_meta( $user_id, 'community-events-location', $saved_location );
    17931793    }
    17941794
Note: See TracChangeset for help on using the changeset viewer.