mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-23 06:55:28 +00:00
Use get_userdata() rather than new WP_User in is_super_admin(), to take advantage of the performance improvements in [21376]. see #21120.
git-svn-id: http://core.svn.wordpress.org/trunk@21377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
174dad02bc
commit
fed9492cbc
@ -1377,12 +1377,10 @@ function get_super_admins() {
|
|||||||
* @return bool True if the user is a site admin.
|
* @return bool True if the user is a site admin.
|
||||||
*/
|
*/
|
||||||
function is_super_admin( $user_id = false ) {
|
function is_super_admin( $user_id = false ) {
|
||||||
if ( $user_id )
|
if ( ! $user_id )
|
||||||
$user = new WP_User( $user_id );
|
$user_id = get_current_user_id();
|
||||||
else
|
|
||||||
$user = wp_get_current_user();
|
|
||||||
|
|
||||||
if ( ! $user->exists() )
|
if ( ! $user = get_userdata( $user_id ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( is_multisite() ) {
|
if ( is_multisite() ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user