Unneccessary term cache query for pages
|Reported by:||TheDeadMedic||Owned by:||nacin|
Description (last modified by scribu)
When a request for a page is queried, $post_type in WP_Query::get_posts() is an empty string, which is then passed to update_post_caches().
This in turn calls update_object_term_cache() for 'post' (the default if $post_type is empty) instead of 'page'.
Since pages don't have taxonomies (at least not in a default setup), we're simply wasting a query. But even if they did have, we wouldn't even be caching the right ones (unless of course pages were assigned the same taxes as posts).
I would say there's two options here; review WP_Query::get_posts() to ensure the local variable $post_type is set correctly, or simply pass the string 'any' to update_post_caches() (which will then correctly determine the post type(s)) - thoughts?
Change History (12)
comment:3 @wonderboymusic — 2 years ago
- Milestone changed from Awaiting Review to 3.5
- Version set to 1.5