src/class-extended-cpt.php
public function maybe_sort_by_taxonomy( array $clauses, WP_Query $wp_query ) : array {

		if ( empty( $wp_query->query['post_type'] ) || ! in_array( $this->post_type, (array) $wp_query->query['post_type'], true ) ) {
			return $clauses;
		}

		$sort = self::get_sort_taxonomy_clauses( $clauses, $wp_query->query, $this->args['site_sortables'] );

		if ( empty( $sort ) ) {
			return $clauses;
		}

		return array_merge( $clauses, $sort );

	}
public function maybe_sort_by_taxonomy( array $clauses, WP_Query $wp_query ) : array {

		if ( empty( $wp_query->query['post_type'] ) || ! in_array( $this->post_type, (array) $wp_query->query['post_type'], true ) ) {
			return $clauses;
		}

		$sort = self::get_sort_taxonomy_clauses( $clauses, $wp_query->query, $this->args['site_sortables'] );

		if ( empty( $sort ) ) {
			return $clauses;
		}

		return array_merge( $clauses, $sort );

	}
public function maybe_sort_by_taxonomy ( array $ clauses , WP_Query $ wp_query ) : array { if ( empty ( $ wp_query -> query [ 'post_type' ] ) || ! in_array ( $ this -> post_type , ( array ) $ wp_query -> query [ 'post_type' ] , true ) ) { return $ clauses ; } $ sort = self :: get_sort_taxonomy_clauses ( $ clauses , $ wp_query -> query , $ this -> args [ 'site_sortables' ] ) ; if ( empty ( $ sort ) ) { return $ clauses ; } return array_merge ( $ clauses , $ sort ) ; }
Filter the query's SQL clauses so we can sort posts by taxonomy terms.

@param  array    $clauses  The current query's SQL clauses.
@param  WP_Query $wp_query The current `WP_Query` object.
@return array              The updated SQL clauses.
Filter the query s SQL clauses so we can sort posts by taxonomy terms .