From 072c0afc5353626dedcae94b0171a9983c2783da Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 16 Dec 2024 23:51:25 +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. Built from https://develop.svn.wordpress.org/trunk@59522 git-svn-id: http://core.svn.wordpress.org/trunk@58908 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-form-advanced.php | 9 +-------- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index b21b50f4ae..319a534fd2 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -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' ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 8a337d5dc5..b78351b843 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.