ControlledChaos
7/21/2017 - 11:36 PM

Archive query arguments for WordPress taxonomies.

Archive query arguments for WordPress taxonomies.

<?php

function ccd_tax_archive_query( $query ) {
	if ( $query->is_main_query() && $query->is_tax( 'cars', 'datsun' ) ) {
		$query->set( 'posts_per_page', '50' );
		$query->set( 'orderby', 'name' );
		$query->set( 'order', 'asc' );
	}
}
add_action( 'pre_get_posts', 'ccd_tax_archive_query' );

?>

Taxonomy Query Arguments

WordPress Snippet