solutionweb

WordPress Common Errors and Solutions

Get_currentuserinfo is no longer recommended for WordPress function. Please use wp_get_current_user () instead.

Today, when judging users and obtaining information such as user nicknames, we used the commonly used get_currentuserinfo (); Method! But WordPress gave me a warning!
Function is too old!

Notice: get_currentuserinfo has been deprecated since version 4.5.0. Please use wp_get_current_user () instead. in ***\wp-includes\functions.php on line 3707
Let’s talk about get_currentuserinfo (); The function!
Retrieves information about the currently logged-in user and puts the information into the $userdata global variable. Function attributes are mapped directly to the wp_usrs table in the database (see Database Description).

Individual attributes are also placed in the following independent global variables:

$user_login
$user_level
$user_ID
$user_email
$user_url (the URL entered by the user in the user profile)
$user_pass_md5 (md5 hash—— of user password-a code that can hardly be decrypted (not completely decrypted), which can compare the difference between the input prompt password and the actual user password)
$display_name (user name, displayed according to the result of’ How to display name’ user option)
Since WordPress4.5, WordPress has abandoned this method and replaced it with another wp_get_current_user () function method! Under normal circumstances, the following methods can be directly replaced!

Back to top