#63014 closed enhancement (fixed)
Enhance `_wp_after_delete_font_family()` performance using the `fields` argument in `get_children()`.
| Reported by: | dilipbheda | Owned by: | flixos90 |
|---|---|---|---|
| Priority: | low | Milestone: | 6.9 |
| Component: | Query | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | performance |
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.
18 months ago
#1
#2
@
16 months ago
- Milestone Awaiting Review → 6.9
- Owner set to
- Priority normal → low
- Status new → reviewing
- Type defect (bug) → enhancement
This ticket was mentioned in Slack in #core by westonruter. View the logs.
10 months ago
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
@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.