Check term cache in _transform_terms()
|Reported by:||misterbisson||Owned by:|
WP3.1's awesome new taxonomy query stuff rocks, but WP_Tax_Query->_transform_terms() seems to be executing multiple identical queries on each page load. The front page of one of my sites gives me five of the following query:
SELECT wp_1_term_taxonomy.term_taxonomy_id FROM wp_1_term_taxonomy INNER JOIN wp_1_terms USING (term_id) WHERE taxonomy = 'channel' AND wp_1_terms.slug IN ('tech')
I understand the function can do a lot more than map a single term+taxonomy to a term_taxonomy_id, but it also looks like there'd be some performance benefit from checking the term cache rather than the DB in those situations.
Or, perhaps it'd be enough to simply cache the result for the duration of the page load.
Or, maybe I'm focusing on the wrong problem, as the query takes just 1-2ms to execute.