#57645 closed enhancement (fixed)
Implement lazy loading term meta in WP_Term_Query
Reported by: | spacedmonkey | Owned by: | spacedmonkey |
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Taxonomy | Keywords: | has-patch has-unit-tests has-dev-note |
Focuses: | performance | Cc: |
Description
When using WP_Term_Query
class, term meta should be lazily loaded, as term meta is not required for most page loads. Term meta can easily be lazily load using existing apis found in core in the WP_Metadata_Lazyloader
class.
Change History (11)
This ticket was mentioned in PR #4010 on WordPress/wordpress-develop by @spacedmonkey.
20 months ago
#1
- Keywords has-patch added
This ticket was mentioned in PR #4153 on WordPress/wordpress-develop by @spacedmonkey.
19 months ago
#2
Make it so that term meta is always lazy loaded.
Trac ticket: https://core.trac.wordpress.org/ticket/57645
#4
@
18 months ago
I think this is a good idea.
As some idle pondering rather than a passive aggressive change request.
Would it be better to introduce an additional attribute to term queries, lazy_load_term_meta
with the default value true?
If for some reason, a developer wishes to group the database queries to run all at once per the current set up, they could set the value to false
.
#5
@
18 months ago
Would it be better to introduce an additional attribute to term queries, lazy_load_term_meta with the default value true?
I did consider this, but the problem is that many developers do not use update_term_meta_cache
as is. Term meta is being loaded when it should not be. There are even places in core like #57701 where it is being loaded.
I think that we should be aggressive in caching term meta, as looking at the plugin repo, it is not heavily used.
Whatever is decided, we should do the same here #57801.
@spacedmonkey commented on PR #4153:
17 months ago
#6
Do you mind taking a look at this @peterwilsoncc ?
#7
@
17 months ago
- Owner set to spacedmonkey
- Resolution set to fixed
- Status changed from new to closed
In 55671:
@spacedmonkey commented on PR #4010:
17 months ago
#8
Committed in 55671
@spacedmonkey commented on PR #4153:
17 months ago
#9
Committed in 55671.
Trac ticket: https://core.trac.wordpress.org/ticket/57645