How to filter custom post types by custom category taxonomy

You are doing a little mistake in your $pargs

As per documentation

Important Note: tax_query takes an array of tax query arguments arrays (it takes an array of arrays). Also you have “post_per_page” instead of “posts_per_page”

$pargs = array(
    'posts_per_page' => '-1',
    'post_type' => 'products',
    'tax_query' => array(
        array(
            'taxonomy' => 'category',
            'field'    => 'slug',
            'terms' => 'specials'
        )
    )
)

Leave a Comment