The problem is with your tax_query — the field (database column name) does not match the terms (database column values):
$args = array(
...
'tax_query' => array(
array(
'taxonomy' => 'state',
'field' => 'name', // <- this should be set to 'slug'
'terms' => $state_slug, // because you provided term slug
),
),
);
I.e. If you provide term slugs (e.g. foo-bar), then the field should be slug; if you provide term names (e.g. Foo Bar), then the field should be name.
Related Posts:
- Display all posts in a custom post type, grouped by a custom taxonomy
- Getting custom taxonomy from custom post type
- Order custom posts by taxonomy?
- List events by month
- Conditional two level dropdown filter for custom post type
- Show all custom post type posts sorted by custom taxonomy then by another custom taxonomy
- get terms that have post with custom post type between 2 values
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- 404 error PageNavi custom type taxonomy | wordpress
- Query for posts in 2 taxonomies
- Show ACF field from custom taxonomy and display on the single template
- Linking three taxonomies with ACF
- Get Custom Field Values by Another Custom Field in WordPress
- How to dynamically build a multiple taxonomy query loop within a post type’s single loop?
- wp_query to find posts by year and month
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Custom Post Type Loop within Shortcode
- get_template_part for each level of taxonomy term
- Display CPT posts based on specific taxonomy
- get_posts of Custom Post Type AND Custom Taxonomy
- WordPress Genesis custom taxonomy archive shows 3 repeats of each post
- Am unable to reset a query properly
- Get next and previous 3 posts in a term in single post page
- Loop custom taxonomy to get lists of cutom post types?
- Show a Category X’s custom post type on Category X archive page?
- Custom Taxonomy terms aren’t getting referenced or saved in Quick Edit or Bulk Edit, only on Single product page?
- Display all taxonomy terms, add class if term applies to current post
- Return the latest post from a custom Taxonomy and Post Type
- Full Custom Post Type List Organised by two Taxonomies
- Query Custom Post Type Taxonomy term with multiple parameters
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- How to group posts and get a mixed posts and groups view?
- Only show posts with date of today or in the future (i.e don’t show past posts)?
- get_the_title() is returning results from previous loop
- Custom post type showing same Post on all Pages
- Control content before and after custom post type loop
- How to define the template for custom posts?
- display posts of custom post type with custom taxonomy
- Custom Post Type not showing in main loop
- My custom taxonomy is only displaying 1 of 3 terms
- Custom Post Type and Taxonomy Loop Output Is Wrong
- List all Custom Post Type posts excluding certain Taxnomy term
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- Custom Sidebar in Editor (not Widget) for Custom Post Type in Genesis
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- Cant’ Display Custom Post Type Title Base on Tax Terms
- Loop and add Specific Categories and Products Images
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- How do i display post from a taxonomy term?
- What is the most efficient way to execute recursive complex queries?
- How can I loop at a Specific Taxonomy from a custom post type?
- Get Posts List of Current Selected Custom Taxonomy in Shortcode
- Custom archive page for custom taxonomy and pagination issue
- How to display list of custom post taxonomy terms and their posts (if any)?
- Custom front-end form for adding post – Category problem
- Custom post type paging return home page
- Excluded Custom Taxonomy Term Posts Displaying in loop
- Show custom post type event if current day using ACF
- Display Custom Field or Custom Taxonomy in front page /post/product
- If ACF Post Object post has custom taxonomy term…
- ACF meta_key and meta_value break loop
- How to display custom post type pagination buttons when processing AJAX request
- posts_per_page is not working by term
- Multiple Custom Post Type in Taxonomy Archive Causing White Screen
- Adding a Section for Visitors
- Why is my loop not populating the page with my custom taxonomy terms from my custom post type?
- Show parent category and subcategory once in while loop
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- Display custom tax in “while” loop
- % encoded URL giving 404 error in WordPress
- CPT: multiple loops with different terms
- Loop to display parent categories in custom taxonomy
- Add active class to foundation 6 tabs while looping categories
- How to show terms used only for particular custom post type. Filter creation perpose
- Display related post content and custom field content
- Show posts for current taxonomy
- WordPress query posts by custom post type not workng
- Custom taxonomy page template
- Loop with Custom Post Type and Taxonomies
- Loop multiple taxonomy in custom post
- $post breaking container loop
- Post data in separate divs with incrementing class using WP_Query
- WordPress Custom Post Type and sort by Tags
- Display posts from category in page
- How to query the content of a specific custom post type?
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- Sorting custom post types by taxonomy (So close)
- Looping taxonomy in taxonomy?
- Listing custom post type items from a couple of custom taxonomies
- Custom Post Type Loop breaking php
- Styling first post using Advanced Custom Fields
- Catergory args causing loop not to show
- ACF Relationship: Group posts by parent category term, then child [closed]
- Get all active posts that are tied to a custom taxonomy for a custom post type
- Filter page ID outside the loop and order
- Custom taxonomy meta fields
- Custom Sort Order for Custom Post Type Taxonomy
- Complex Custom Loop with Includes
- WordPress post objects in one parent post object
- Custom fields disappearing when a custom post type is assigned