ndexed terms. * * @param bool $limit The maximum number of term IDs to return. * * @return string The prepared query string. */ protected function get_select_query( $limit = false ) { $indexable_table = Model::get_table_name( 'Indexable' ); $taxonomy_table = $this->wpdb->term_taxonomy; $public_taxonomies = $this->taxonomy->get_indexable_taxonomies(); if ( empty( $public_taxonomies ) ) { return ''; } $placeholders = \implode( ', ', \array_fill( 0, \count( $public_taxonomies ), '%s' ) ); $replacements = [ $this->version ]; \array_push( $replacements, ...$public_taxonomies ); $limit_query = ''; if ( $limit ) { $limit_query = 'LIMIT %d'; $replacements[] = $limit; } // Warning: If this query is changed, makes sure to update the query in get_count_query as well. return $this->wpdb->prepare( " SELECT term_id FROM {$taxonomy_table} AS T LEFT JOIN $indexable_table AS I ON T.term_id = I.object_id AND I.object_type = 'term' AND I.version = %d WHERE I.object_id IS NULL AND taxonomy IN ($placeholders) $limit_query", $replacements ); } } ndexed terms. * * @param bool $limit The maximum number of term IDs to return. * * @return string The prepared query string. */ protected function get_select_query( $limit = false ) { $indexable_table = Model::get_table_name( 'Indexable' ); $taxonomy_table = $this->wpdb->term_taxonomy; $public_taxonomies = $this->taxonomy->get_indexable_taxonomies(); if ( empty( $public_taxonomies ) ) { return ''; } $placeholders = \implode( ', ', \array_fill( 0, \count( $public_taxonomies ), '%s' ) ); $replacements = [ $this->version ]; \array_push( $replacements, ...$public_taxonomies ); $limit_query = ''; if ( $limit ) { $limit_query = 'LIMIT %d'; $replacements[] = $limit; } // Warning: If this query is changed, makes sure to update the query in get_count_query as well. return $this->wpdb->prepare( " SELECT term_id FROM {$taxonomy_table} AS T LEFT JOIN $indexable_table AS I ON T.term_id = I.object_id AND I.object_type = 'term' AND I.version = %d WHERE I.object_id IS NULL AND taxonomy IN ($placeholders) $limit_query", $replacements ); } }