I’ve created a custom taxonomy type named ‘div2’ and I want to use it in WP_Query.
The problem is that I cannot make it work properly.
This is my code:
$args = array(
'post_type' => 'vd_equipos',
'posts_per_page' => $cantidad,
'orderby' => 'title',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => 'primera-division',
),
),
);
But shows no data. Maybe the problem is in the ‘tax_query’ definition, I really do not know
I already tested it, but still not working
Well, if you’ve created a custom taxonomy then that value must be the value of your custom taxonomy. Other than this I see no reason it should not be working unless there are no posts of that post type that are in that term of the taxonomy.
I’m attaching an image of the custom field configuration.
There are posts with that taxonomy, that’s my concern about it.
The field name is “div2” that is not the taxonomy.
What is the taoxnomy?
The taxonomy is ‘category’