[wp-trac] [WordPress Trac] #58116: rest_{$this->taxonomy}_query Cache Problem

WordPress Trac noreply at wordpress.org
Thu Apr 13 16:30:11 UTC 2023


#58116: rest_{$this->taxonomy}_query Cache Problem
--------------------------+------------------------------------
 Reporter:  tnolte        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:  6.0
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  rest-api, performance
--------------------------+------------------------------------

Comment (by tnolte):

 @peterwilsoncc this is what we have set:
 {{{#!php
 <?php
                 // Set to query specific posts types if set.
                 if ( ! empty( $post_types ) ) {
                         $clauses['fields'] = 'DISTINCT ' . str_replace(
 'tt.*', 'tt.term_taxonomy_id, tt.taxonomy, tt.description, tt.parent',
 $clauses['fields'] ) . ', COUNT(p.post_type) AS count';
                         $clauses['join'] .= ' LEFT JOIN ' .
 $wpdb->term_relationships . ' AS r ON r.term_taxonomy_id =
 tt.term_taxonomy_id LEFT JOIN ' . $wpdb->posts . ' AS p ON p.ID =
 r.object_id';
                         $clauses['where'] .= ' AND (p.post_type IN (' .
 implode( ',', $post_types ) . ') OR p.post_type IS NULL)';
                         $clauses['orderby'] = 'GROUP BY t.term_id ' .
 $clauses['orderby'];
                 }

                 // Set to query posts with specific status.
                 if ( ! empty( $post_status ) ) {
                         $clauses['where'] .= ' AND (p.post_status IN (' .
 implode( ',', $post_status ) . '))';
                 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58116#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list