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

Follow-up to [19325].

Props upadalavipul.
See #60021.

git-svn-id: https://develop.svn.wordpress.org/trunk@57190 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2023-12-15 12:35:54 +00:00
parent f2c78fe642
commit 7914d30555

View File

@ -117,13 +117,18 @@ class WP_User {
*
* @since 2.0.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param int|string|stdClass|WP_User $id User's ID, a WP_User object, or a user object from the DB.
* @param string $name Optional. User's username
* @param int $site_id Optional Site ID, defaults to current site.
*/
public function __construct( $id = 0, $name = '', $site_id = '' ) {
global $wpdb;
if ( ! isset( self::$back_compat_keys ) ) {
$prefix = $GLOBALS['wpdb']->prefix;
$prefix = $wpdb->prefix;
self::$back_compat_keys = array(
'user_firstname' => 'first_name',
'user_lastname' => 'last_name',