I had to modify queries before they run. So the best practice was to add the following code to function.php:
if (!function_exists('my_theme_filter')) {
function my_theme_filter( $query ){
if ( $query->is_main_query() )
if ( $query->get( 'tag' ) OR is_search() )
$query->set( 'post_type', array( 'artprim_item' ) );
//echo '<pre>'; print_r($query); echo '</pre>';
return $query;
}}
add_filter( 'pre_get_posts', 'my_theme_filter' );
-
if ( is_search() )
was necessary for taxonomy, this is what made this URL works :http://website.com/tax_groups/a_random_group/
It’s surprising and made me lost a lot of time since the search by itself was already working just fine
-
if ( $query->get( 'tag' ) )
obviously was necessary for