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.
Built from https://develop.svn.wordpress.org/trunk@59522


git-svn-id: http://core.svn.wordpress.org/trunk@58908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2024-12-16 23:51:25 +00:00
parent 2b5ee6e41c
commit 072c0afc53
2 changed files with 2 additions and 9 deletions

View File

@ -25,14 +25,7 @@ $current_screen->is_block_editor( false );
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' );
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.8-alpha-59521';
$wp_version = '6.8-alpha-59522';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.