Skip to content

Commit f6fb194

Browse files
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
1 parent 8eaaf53 commit f6fb194

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/wp-admin/edit-form-advanced.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,7 @@
2525
if ( is_multisite() ) {
2626
add_action( 'admin_footer', '_admin_notice_post_locked' );
2727
} else {
28-
$check_users = get_users(
29-
array(
30-
'fields' => 'ID',
31-
'number' => 2,
32-
)
33-
);
34-
35-
if ( count( $check_users ) > 1 ) {
28+
if ( get_user_count() > 1 ) {
3629
add_action( 'admin_footer', '_admin_notice_post_locked' );
3730
}
3831

0 commit comments

Comments
 (0)