Make WordPress Core


Ignore:
Timestamp:
12/15/2023 12:35:54 PM (11 months ago)
Author:
SergeyBiryukov
Message:

Docs: Document the $wpdb global in WP_User::__construct().

Follow-up to [19325].

Props upadalavipul.
See #60021.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-user.php

    r56184 r57190  
    118118     * @since 2.0.0
    119119     *
     120     * @global wpdb $wpdb WordPress database abstraction object.
     121     *
    120122     * @param int|string|stdClass|WP_User $id      User's ID, a WP_User object, or a user object from the DB.
    121123     * @param string                      $name    Optional. User's username
     
    123125     */
    124126    public function __construct( $id = 0, $name = '', $site_id = '' ) {
     127        global $wpdb;
     128
    125129        if ( ! isset( self::$back_compat_keys ) ) {
    126             $prefix                 = $GLOBALS['wpdb']->prefix;
     130            $prefix = $wpdb->prefix;
     131
    127132            self::$back_compat_keys = array(
    128133                'user_firstname'             => 'first_name',
Note: See TracChangeset for help on using the changeset viewer.