@Krzysiek answer above didn’t work because have_posts is a method not a property. It should be have_posts() not have_posts. Here’s the corrected code:
$my_query = new WP_Query( array(
'post_type'=>'news',
'posts_per_page'=>4,
'tax_query'=>array(
array(
'taxonomy'=>'instituteName',
'field'=>'slug',
'terms'=>'businessschool' // change to real slug
)
)
) );
while ( $my_query->have_posts() ) {
$my_query->the_post();
// display post
}
Related Posts:
- Glossary with Custom Post Type
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- How to filter the taxonomy terms based on another taxonomy term
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- Custom Post Type Archive Page Filtering
- Allow user to set custom order to a list of custom taxonomies?
- Which post does a taxonomy term belongs to?
- How to get custom posts sub category link
- WP the_posts() on single-cars.php get category link
- Get parent category id from child category page for custom taxonomy
- The Difference Between Categories and Tags and Taxonomies and Terms
- Get terms for a specfic post from multiple taxonomies in custom post type
- Retrieve Custom Taxonomies with Description and Slug
- Using get_terms() to list terms from one custom taxonomy AND from one specific built-in category
- How to display custom taxonomy term specific post?
- How to manage a dynamic multi-level page hierearchy system?
- Display title of all custom posts from same taxonomy term on a custom post template
- How to get all posts related to a taxonomy?
- Filter By Term Not Working – Custom Post Type
- Custom Post Status & Taxonomies
- Post Editor: display categories from current post type taxonomy only?
- Get a list of categories ids
- How to create new category for custom post type?
- How to check the terms in single custom post type template
- Weird problem happening with custom taxonmy when creating/updating posts
- How to get the post type from a category id?
- Displaying a custom post types custom taxonomy value?
- Insert HTML inside link in a walker
- get_the_terms return only last term
- Custom Post Types and independent Categories – complex Taxonomy
- Does WordPress limit the length of slug names for Post Meta or Terms?
- Should I use custom taxonomy or custom post type
- Set menu active state for custom posttype and category, given custom taxonomy term
- get_post_meta returns empty array for terms
- Show listings from Impress Listing plugin in random order using taxonomy and terms
- Display all posts in main category and 1 subcategory
- Update post terms with custom taxonomy
- How do I display tags for a custom post type single page?
- Getting posts under the custom post type ui category
- How can I auto-assign a CPT post to category in a custom taxonomy when published?
- Filtering WP_Query Dynamically on the Front-End
- Get template part using a custom taxonomy term
- Get posts by querying taxonomy and certain terms of the taxonomy?
- How to restrict users and admin from creating new taxonomy terms?
- Posts from all the categories are being displayed instead of particular category
- Conditional Statement custom post type category
- Show custom post type filtered by category
- Custom Post Type With Categories
- Missing Posts in Custom Taxonomy List
- using $wpdb to get custom post type with term
- Categories sorting
- Show posts from two or more custom taxonomy terms
- get_category_parents for custom post type taxonomy
- Disable block with taxonomies at post page
- Displaying custom taxonomy in the admin list of a custom post type
- wp_list_categories() – current-cat class also inside posts?
- Showing posts from different categories and from custom post type
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- List custom taxonomy specific to one custom post type
- Show a Category X’s custom post type on Category X archive page?
- Display post as term id
- Cannot add category or custom taxonomy from admin. WordPress site is hosted in Windows 16 server via IIS. No XAMPP or WAMP
- Add custom post type settings to wordress default posts
- How do I display the taxonomy term alongside the post type post title?
- Hide parent categories when clicked, and show it’s childs
- Get related posts of child term of custom post type
- Limit amount of posts made within a custom taxonomy
- Problem with displaying posts in the CPT category
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- Filter CPT posts by one or more categories
- Getting categories of posts under a custom taxonomy
- Post count by month of taxonmy term
- Can’t remove front from permalinks for custom taxonomy category page
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- Set a checkmark in a category based on a URL-parameter
- How do I display the taxonomy for a custom post type in an array
- How to edit this code to get the categories in achieve page?
- Get the category from custom post type
- Display Custom Taxonomy Alphabetically
- Custom Post Slug same as Parents Category Slug
- How do I require the specification of term in a custom post type and custom taxonomy?
- Custom Post, set object Taxonomy terms in plugin
- Hierarchy and access control for Custom Post Types (CPT)
- Get terms that contain posts that in turn belong to other terms?
- Best method to make posts searchable, sortable and filterable – custom field, tag or category?
- Custom while loop for hierarchical display of a taxonomy
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- Display taxonomy terms, child terms and posts in a template
- Use custom walker to add taxonomy terms to main nav menu
- browse by category and tags?
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Add term to custom post type on draft
- List of Posts and Categories
- Displaying custom-taxonomy-terms sorted by parent/child-hierarchy?
- How can I show 1 featured post in a styled element, and the next few below differently styled
- Listing all term items alphabetically / sorting loop
- Custom Post Type Category Link
- Custom Post type category pages template and loop