Make WordPress Core

Changeset 59522


Ignore:
Timestamp:
12/16/2024 11:49:11 PM (6 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-advanced.php

    r59511 r59522  
    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    }
Note: See TracChangeset for help on using the changeset viewer.