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/includes/nav-menu.php

    r50505 r50981  
    155155    if ( false === get_user_option( 'managenav-menuscolumnshidden' ) ) {
    156156        $user = wp_get_current_user();
    157         update_user_option(
     157        update_user_meta(
    158158            $user->ID,
    159159            'managenav-menuscolumnshidden',
     
    164164                3 => 'description',
    165165                4 => 'title-attribute',
    166             ),
    167             true
     166            )
    168167        );
    169168    }
     
    200199
    201200    $user = wp_get_current_user();
    202     update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
     201    update_user_meta( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes );
    203202}
    204203
Note: See TracChangeset for help on using the changeset viewer.