#63014 closed enhancement (fixed)
Enhance `_wp_after_delete_font_family()` performance using the `fields` argument in `get_children()`.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | low |
| Severity: | normal | Version: | |
| Component: | Query | Keywords: | has-patch |
| Focuses: | performance | Cc: |
Description
The _wp_after_delete_font_family() function can be optimized by leveraging the fields argument in the get_children() function. Currently, the function retrieves unnecessary data, which affects performance.
Since we use only the ID field in the wp_delete_post() function from the get_children() object, adding the fields argument will limit the query to fetch only the required IDs, improving both performance and efficiency.
Change History (4)
This ticket was mentioned in PR #8407 on WordPress/wordpress-develop by @dilipbheda.
10 months ago
#1
#2
@
8 months ago
- Milestone changed from Awaiting Review to 6.9
- Owner set to flixos90
- Priority changed from normal to low
- Status changed from new to reviewing
- Type changed from defect (bug) to enhancement
This ticket was mentioned in Slack in #core by westonruter. View the logs.
8 weeks ago
Note: See
TracTickets for help on using
tickets.
@dilipbheda Thanks for raising this, the change makes sense to me.
I wasn't sure at first because
wp_delete_post()looks up the post object anyway before deleting, so I thought looking it up in the query would be good to warm the caches.But turns out that
wp_delete_post()will always make a database request for it regardless of caches, so the extra query before to warm the caches is indeed pointless.It's probably not going to have a notable impact on performance, but should be straightforward and low-risk enough to move forward.
Changing this to an enhancement, since it's a performance improvement, not a bug fix.