WP_Query::parse_tax_query() performed twice during get_posts
-
Is there a reason why WP_Query::parse_tax_query() is called twice during WP_Query::get_posts() execution? First during parse_query and later during get_posts itself.
This prevents any custom changes to the “default” parsing of application defined taxonomies, since the second call is done immediately before appending the result SQL to the join and where clauses (query.php:2207).
Specifically we are trying to use the “term_id” field instead of the default “slug” during a “tax query”, for the purpose of making it “efficient” (given that we already got the list of term_id values).
The idea was to use the “pre_get_posts” action to do the adjustment to the parsed structure. The second parse_tax_query call is overriding those adjustments.
Unless there is a strong reason for the second call and/or there is another way to build an efficient custom tax query, would this be something that could be “fixed”?
The topic ‘WP_Query::parse_tax_query() performed twice during get_posts’ is closed to new replies.