Opened 3 years ago
Closed 5 weeks ago
#55958 closed enhancement (fixed)
Checking if _admin_notice_post_locked should be called can slow down the post editing
Reported by: | berislav.grgicak | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | 4.9 |
Component: | Editor | Keywords: | has-patch |
Focuses: | performance | Cc: |
Description
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
Attachments (1)
Change History (10)
#1
follow-up:
↓ 2
@
3 years ago
- Focuses performance added
- Type changed from defect (bug) to enhancement
- Version changed from trunk to 4.9
#2
in reply to:
↑ 1
@
3 years 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.
#3
follow-up:
↓ 7
@
5 weeks ago
@costdev we just ran into this again recently.
We're hosting WooCommerce.com, a huge WooCommerce store, and we are receiving about 1000 "MySQL server has gone away" errors per month because of this issue.
I submitted a patch that fixes it for us, but it'd be great if it makes it into core to potentially fix it for other users.
#5
@
5 weeks ago
- Milestone changed from Awaiting Review to 6.8
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
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.