Make WordPress Core


Ignore:
Timestamp:
10/17/2022 04:53:54 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Users: Revert use of shared objects for current user.

Reverts [50790].

Props oztaser, ravipatel, dd32, costdev, SergeyBiryukov, tykoted, cu121, xknown.
Merges [54397] to the 6.0 branch.
Fixes #54984.

Location:
branches/6.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.0

  • branches/6.0/src/wp-includes/pluggable.php

    r54539 r54544  
    9292         * @since 2.8.0
    9393         * @since 4.4.0 Added 'ID' as an alias of 'id' for the `$field` parameter.
    94          * @since 5.8.0 Returns the global `$current_user` if it's the user being fetched.
    9594         *
    9695         * @global WP_User $current_user The current user object which holds the user data.
     
    101100         */
    102101        function get_user_by( $field, $value ) {
    103                 global $current_user;
    104 
    105102                $userdata = WP_User::get_data_by( $field, $value );
    106103
    107104                if ( ! $userdata ) {
    108105                        return false;
    109                 }
    110 
    111                 if ( $current_user instanceof WP_User && $current_user->ID === (int) $userdata->ID ) {
    112                         return $current_user;
    113106                }
    114107
Note: See TracChangeset for help on using the changeset viewer.