Your tax query is incorrect, field
should be the field you want to query on: term_id
, name
, or slug
–
$posts_array = get_posts(
array(
'posts_per_page' => -1,
'post_type' => 'fabric_building',
'tax_query' => array(
array(
'taxonomy' => 'fabric_building_types',
'field' => 'term_id',
'terms' => $cat->term_id,
)
)
)
);
Related Posts:
- Get Posts Under Custom Taxonomy
- How do I get the slug of a custom taxonomy category of a post?
- Get posts by name and taxonomy term
- How to get post count including nested categories
- How to show related posts by category
- Different post sort order within different categories
- Displaying the category name of a custom post type
- Show WordPress Custom Taxonomy Items Based On a Selected Item From Another Custom Taxonomy
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- Query only Posts from Both of Two Category?
- Show Custom Taxonomy Categories, Listing of Posts, and Single Post via AJAX
- is there a better way of combining this?
- Adding Multiple Values to a Post Meta Key
- Posts are not showing up on particular category
- How can I add a meta-box to the posts editor containing all items of a custom taxonomy as checkbox?
- Get Posts via Taxonomy Term Name with Space
- How to set up multiple taxonomies for groups of posts
- Get mixed category random posts
- Choose whether to automatically add a taxonomy with the same name as the post
- Posts list in custom taxonomy
- How to Restrict Previous & Next Post Link to Posts of Same Category?
- Get attachments for posts that belongs to a specific category
- Prepending %category% onto default posts fails
- How can I setup a relationship using categories in WordPress?
- How can I hide tags on a child-category page, if that tag has not been used?
- Display posts of specific category term
- How to create a “latest news” page showing a list of posts from blog category
- WordPress bulk category select when publishing post
- How to show a custom taxonomy in the theme?
- How to get post with slug and exclude categories
- How to get posts by category and by choosing a taxonomy term?
- Unable to differentiate between two categories under custom post type on single.php
- Geting error in post and category [closed]
- How to add content above footer in posts from specific category
- How to associate a custom taxonomy to a post multiple times
- Create/Set Category as Title of Post
- How to manage a dynamic multi-level page hierearchy system?
- Page with Category Returning 1
- Customizing URL slugs of Custom Post Type and Taxonomy make posts/pages 404
- How to Get Position of a Post from a category and tag
- Custom Taxonomy From Database
- Retrieve latest post by multiple categories with ID
- Multiple loops on a Search result page?
- Taxonomy Category category.php not working
- wordpress show category link instead of post link [closed]
- View post with specific category id and name which I selected in the backend (drop-down option)
- Use category base slug in posts’ permalink
- How to get all posts related to particular category name?
- Display the latest post from a category in a page
- How to show list of posts by author and category?
- How to control which category will be picked for the slug of a post?
- Setting pagination for images attached to a post
- wp_update_term is always launched after wp_insert_term
- Post in Multiple Categories to stay in current category (permalink, next previous post link)
- Display empty taxonomy terms with get_terms()
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- Get multidimensional array that reflects category hierarchy
- Exclude posts from featuring
- Articles are text-only in any “Category” instead of HTML
- Categories of custom taxonomy don’t show any posts
- Assign category to new post via URL
- Category Page Template not Showing Posts
- WordPress custom Query for Posts in Category display posts multiple times
- How can I edit the ‘Most Used’ tab in the categories meta-box to show another custom taxonomy?
- Disable sticky option for specific categories
- date issue with category post retrival
- How to make multiple sections in home pulling posts category wise?
- Random posts from a pool of posts
- Showing categories and subcategories with posts
- Change default category when I publish a post
- Conditional Tag for has post [closed]
- Post Image not displaying in category view
- relating business and products with custom taxonomy?
- Exclude post category in a blog page
- WP_Query of Category Not Showing First Post
- How to make posts being uncategorized
- How to display a single(current) post from a category
- displaying the categories post
- How to get posts using category slug in ClassiPress?
- Define multiple prefixes for custom post type
- How to Create another Page Category like the “Post” and “Pages”
- How to create a button to filter posts (list) by meta value
- Is there a way to save different data when USER interacts with the same POST?
- REST API Working for GET but not for POST?
- Fill the exclude array() in get_posts()
- show only one category and filter by tag
- AJAX load more posts not using correct category and repeating the same few posts
- Category posts show on local install, they do not show on live server
- How can I exclude only a specific sub category post from category display?
- Newly created category does not show category
- How to pass multiple checkbox values to wordpress query?
- Show a Category Specific Info Box
- How to get all the terms of a post
- Display the first post’s comments of category in comments.php template
- How to filter categories of a post
- How to get single post by one author?
- List posts related to category on a div [closed]
- how to show all post with its contents
- CSS – Change height of Storefront / WooCommerce product categories, but not products
- How to make category for word post_content