A simple search in codex shows how to do that :
$args = array(
'post_type' => 'post',
'tax_query' => array(
array(
'taxonomy' => 'people',
'field' => 'slug',
'terms' => 'bob'
)
)
);
$query = new WP_Query( $args );
EDIT: do not use showposts
, it’s deprecated.
Related Posts:
- Displaying the category name of a custom post type
- wp query with dynamic taxonomies and terms?
- Why won’t my taxonomy query show up?
- How to insert 2 args into 1 Wp_Query for a slideshow
- How to get Tags with specific post id
- Display posts of specific category term
- My custom query is displaying random posts in random order
- Multiple loops on a Search result page?
- Help with Taxonomies
- Ajaxify This Code
- How to filter my search in post if contains a word in title, content or excerpt?
- Posts list in custom taxonomy
- How to return another post than requested
- Pausing and Resuming WP_Query results
- How to do set post permalinks using 6 digit random unique function?
- Select only post id and meta value with WP_Query
- Lost draft under all posts and drafts
- Get user categories with most posts in it
- Get Posts Under Custom Taxonomy
- Random ajax load only works with posts_per_page set to -1
- How to : pagination in 3 different custom loops on the same page
- How to render taxonomy in loop of custom post_type
- How safe is renovating $wp_query when doing WP_Query pagination in Page Template
- Exclude the first ‘n’ number of posts of a tag from home page?
- Query posts and return XML
- how to change the number of posts returned in a specific loop without making it global?
- Query Posts With Over 1000 Views
- How to allow visitors to filter posts by multiple taxonomies
- How to add tags (custom taxonomy) to post class css?
- posts_per_page option limits the number of Gallery items
- List authors with the last post title and order by last post date
- How to order posts by meta_value and title
- Saving custom fields to a custom taxonomy
- wp_query random post
- wp_posts table: safely remove unused columns to save database storage
- Query Posts by Custom Field
- Adding a blog archive with pagination using WP_Query
- WP the_posts() on single-cars.php get category link
- how can i change WP main archives loop to sort by name or title
- Using wp_list_pages() after calling query_posts()
- how to get post order by post id wp_query?
- Possible to alternate between two loops
- Nested WP_Query breaking loop
- WordPress query_posts by tag doesn’t work anymore(?)
- How to display all posts divided/ordered by post date? [closed]
- Why Query is returning empty array?
- How do I extract just the post ID of the first item in whatever WP_Query returns?
- Show post content and title in diferent divs using WP_Query using a loop
- Why are my paginated posts always returning the same results?
- Ignore latest two posts
- Is it possible to use WP_Query to only pull posts with attachments?
- Displaying posts that belong to a specific author
- Get posts and include taxonomy term
- Show posts by author of membership level (Paid Membership Pro)
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- meta_value timestamp older than now
- Every second post different class in blog view
- Loop doesn’t exclude the specified category in home page
- Get posts with multiple categories
- Do not show children of a category
- Variable not working in WP_Query
- Print out last 3 blogposts
- why the same code got different results when using query_posts in functions.php and index.php
- Query posts by Author and/or by Tag
- Query for first 3 posts to change the look and feel
- How to get posts published on the latest date?
- Why posts array is empty?
- Form to post new post with custom taxonomies
- Can’t understand why sometimes a [caption] field appears
- Page and post loop same template
- Getting blog pagination to work on page set as front page
- How to show a custom taxonomy in the theme?
- How to group only VISIBLE posts? [closed]
- How to check in functions.php if there is data in a WP_Query?
- Shortcode with ‘year’ parameter
- search blog posts by author first name and or last name
- Show metabox value last post excerpt, title and link
- On what hook can I get the queried object’s final state?
- Check if current user has a post and that post has any term/s from a specific custom taxonomy outside the loop
- unique post in “$args” of wp_query display more than one post
- Display current post position in Elementor Posts widget
- Why in my query is display two title?
- Migrate posts from category and sub-category via SQL
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- wp_query with ajax
- How to give classname to post if post has no content?
- display posts of custom post type with custom taxonomy
- Custom wp-query in wordpress rest api
- WP_Query: Show 10 posts in date order, first three random
- How can I insert a new markup element after 4 posts automatically? [closed]
- Exclude some posts from displaying in wp_query based on some condition
- posts_per_page returning only one post
- If no posts exist for current day and month, show the next available day of posts
- Programatically adding custom filters to post list
- WordPress Loop: How to display recent posts in multiple divs
- Random posts that always include a particular post?
- Need to know custom code to display random and most viewed posts in wordpress posts and pages
- Related Posts function not working
- How to retrieve certain number of images from a wordpress post?
- WordPress post filter menu