[wp-trac] [WordPress Trac] #35816: Add "after_get_posts" action to `WP_Query::get_posts()`
WordPress Trac
noreply at wordpress.org
Sat Feb 13 03:04:08 UTC 2016
#35816: Add "after_get_posts" action to `WP_Query::get_posts()`
---------------------------+--------------------------
Reporter: stevegrunwell | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.5
Component: Query | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses: performance
---------------------------+--------------------------
Comment (by boonebgorges):
In [changeset:"36524"]:
{{{
#!CommitTicketReference repository="" revision="36524"
Improve `WP_Query` lazyloading logic, for better performance.
Lazyloading for comment meta and term meta, introduced into `WP_Query` in
4.4, used flags - `updated_term_meta_cache` and
`updated_comment_meta_cache` -
in an attempt to prevent cache priming from happening more than once per
query
object. This technique was mostly effective, but not entirely efficient,
since
the flag didn't prevent the `lazyload_*_meta` callbacks from running. The
obvious solution - removing the filter callback after it'd be run once -
was
dismissed for 4.4 because of concerns that `remove_filter()` could disable
lazyloading too generally in the context of nested queries, due to the way
`_wp_filter_build_unique_id()` doesn't always build sufficiently unique
IDs for
similar objects. However, further testing shows that this concern is only
valid
in a very small subset of cases, while the cost of keeping the query
objects in
memory, via the `$wp_filter` global, is quite significant. As such, this
changeset removes the flags in favor of the `remove_filter()` technique.
See #35454, #35816.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35816#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list