Home › Forums › General Issues › Problem with WP_Query with Custom Taxonomy Types
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


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?
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.