From f6fb194a0755d82037247916305b51ae70b995d0 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 16 Dec 2024 23:49:11 +0000 Subject: [PATCH] Editor: Check `get_user_count()` instead of `get_users()` for the locked post notice. This aims to avoid slowing down the post editing by using a cached value instead of calling `get_users()`, which can be slow when plugins add various filters to all `get_users()` calls, especially with meta value comparisons on large `user_meta` tables. Follow-up to [24304], [24543], [41829], [53011], [53018]. Props berislav.grgicak, bor0, costdev. See #55958. git-svn-id: https://develop.svn.wordpress.org/trunk@59522 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/edit-form-advanced.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/wp-admin/edit-form-advanced.php b/src/wp-admin/edit-form-advanced.php index b21b50f4ae4df..319a534fd2791 100644 --- a/src/wp-admin/edit-form-advanced.php +++ b/src/wp-admin/edit-form-advanced.php @@ -25,14 +25,7 @@ if ( is_multisite() ) { add_action( 'admin_footer', '_admin_notice_post_locked' ); } else { - $check_users = get_users( - array( - 'fields' => 'ID', - 'number' => 2, - ) - ); - - if ( count( $check_users ) > 1 ) { + if ( get_user_count() > 1 ) { add_action( 'admin_footer', '_admin_notice_post_locked' ); }