Make WordPress Core

Opened 23 months ago

Last modified 23 months ago

#55958 new enhancement

Checking if _admin_notice_post_locked should be called can slow down the post editing

Reported by: berislavgrgicak's profile berislav.grgicak Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9
Component: Editor Keywords:
Focuses: performance Cc:


On wp-admin/edit-form-advanced.php:28, WordPress checks if multiple users exist to call _admin_notice_post_locked.

In some cases, plugins add additional filters to all get_users calls to ensure that a user role doesn't have access to private data.
If these checks use meta value comparisons, it can slow post-editing on sites with large user_meta tables.

The root cause of this issue is how WordPress stores and validates user capabilities, but the _admin_notice_post_locked check could be optimized without fixing the root cause.

Some suggestions on how to fix this would be:

  • caching the $check_users value
  • using a boolean option that is true if a site has multiple users
  • adding a filter that allows manually setting $check_users to skip this check

Change History (2)

#1 follow-up: @costdev
23 months ago

  • Focuses performance added
  • Type changed from defect (bug) to enhancement
  • Version changed from trunk to 4.9

Hi @berislavgrgicak, welcome to Trac!

I'm just modifying the ticket's parameters to help get this some more focus and help to track down when this was introduced.

This check was introduced in WordPress 4.9.

#2 in reply to: ↑ 1 @berislav.grgicak
23 months ago

Thank you @costdev!

I would be happy to help with this, but I'm not sure what would be the best way to improve the performance.

Note: See TracTickets for help on using tickets.