The documentation for WP_Query is the place to look for this 🙂
In particular, you’re after the taxonomy query parameters. Adding a tax_query
to your code will look like this:
$rate_query = new WP_Query( array (
'post_type' => 'movies',
'posts_per_page'=>'5',
'tax_query' => array(
array(
'taxonomy' => 'movie_genre',
'field' => 'slug',
'terms' => array( 'movie-genre-2' ),
),
),
) );
Then just adjust the slugs of both your taxonomy and terms to match how they are defined. You can also include multiple terms.
In addition, there’s a lot more fine-grained control you can add to the query if you like, which is covered in the aforementioned docs.
Related Posts:
- get_the_term_list without links in 3.1
- Custom columns on edit-tags.php main page
- get_term_children for immediate children only (not grandchildren)
- Custom taxonomies capabilities
- Can’t get a custom template taxonomy page to display
- Display category posts grouped by taxonomy
- Creating a non-removable taxonomy term
- Can I turn off write-in tags/taxonomies?
- Is it possible to use one slug for Multiple Taxonomies?
- Is it possible to add taxonomies to user profiles?
- Get terms from multiple taxonomies
- Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request
- Displaying the Name of the Queried Taxonomy Term on a Term Archive Page?
- How can I set a default listing order on the admin page for a custom taxonomy? (without plugins)
- Is it possible to sort the post based on a custom field?
- How do I get terms as a list for a specific post?
- get taxonomy terms for parent and child
- On Taxonomy Template page, want to add Post_Type
- Taxonomy query for children of parents
- Separator for multiple terms
- The next_posts_link() show me a aditional page in blank
- Help building array hierarchically with taxonomies (to get posts)
- Removing the base “Author” or changing it to something else. is it possible?
- how to get title to custom tags page
- What are terms and taxonomy, how they related to post and how these three are stored in database?
- Get multiple term objects by ids
- Echo custom taxonomy term name
- Next and Previous links on a single taxonomy page only link to same term
- Why does WP rename similar “term name”-slugs in separate taxonomies?
- How can I get WP to build a feed based on multiple taxonomy terms
- Get custom taxonomy description with paragraph tags
- Getting the selected terms for custom taxonomies in the editor
- Change permalink of post if it belongs to custom taxonomy
- Get pages only with a specific taxonomy
- Set custom post type terms by id without knowing taxonomy
- Share taxonomy between user and posts?
- How to determine the depth of a term in a custom taxonomy?
- How do I Use Multiple Loops with WP_Query?
- $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
- How to obtain the link/URL to the feed of a custom taxonomy?
- get_term_children doesn’t return an array of children terms
- Term count by user
- Catchable fatal error on custom category post
- add taxonomy as one of menu items
- How to add contents of a custom field to a taxonomy term list?
- Google Map Shortcode for Custom Taxonomy/Post Types
- Querying two taxonomies
- How to target parent product category and its children using WooCommerce?
- Custom taxonomy query is empty. 0 = 1 in SQL
- How do you reorder the custom taxonomies on the right side of a custom post edit page?
- Query posts by taxonomy with current term
- Custom Taxonomies not retaining hierarchy while importing from one site to another
- List Posts For Terms Of A Custom Taxonomy For Any Post Type
- What is the most efficient way of implementing a notification system? [closed]
- Remove custom taxonomy column from my custom post type columns
- Get posts by Taxonomy without terms
- Check if custom taxonomy has posts with get_categories()
- How to add images to taxonomy terms? [duplicate]
- Echo custom taxonomy slug
- Admin (All posts) stop responding problem
- Why get_page_template() doesn’t show taxonomy template file name?
- Remove a href from this code
- Adding a second custom taxonomy to a custom post type (both shown in its table)?
- custom post type, hide or disable the status line in publish meta box
- Get post terms from multiple custom taxonomies
- How to get attached image to taxonomy..?
- delete term from taxonomy and assign in new one
- How to get list of only custom taxonomies?
- Template file renders on local install, not on web
- Disable a Custom Taxonomies default save mechanism
- Replicate Drupal form options as taxonomies?
- Listing only custom post types with two required categories?
- custom taxonomies label in hebrew
- Amend taxonomy to search in wordpress admin
- Unique taxonomy for post
- Display term picture of each post in a loop
- filter for thumbnail not working for custom taxonomy term
- Custom taxonomy only gets saved in quick edit
- Get tags name under custom taxonomy in wordpress
- Show message if term slug changed
- Get post meta value outside of the loop
- Unable to create a new taxonomy
- Code inside conditional is_tax() only working when term has posts
- Change link of taxonomy when get_the_term_list( is used?
- Get link for taxonomy to show top-level terms
- Invalid taxonomy with custom script
- Multi level archive
- custom taxonomy don’t return a value
- Where to put a migration script to switch post information?
- Gravity prerender taxonomy [closed]
- Advanced search: roles and multiple taxonomies
- One taxonomy template for all categories?
- Get post terms with hierarchical relationships
- Using wp_query is it possible to orderby taxonomy?
- Removing fields from category/taxonomy edit form
- Error in Custom Taxonomy UI
- Remove ‘portfolio’ from URL
- add_rewrite_rule pagination 404 error on page 4 and above
- Taxonomies starting with a hyphen (minus) to assign B.C. dates to a post
- Rewrite URL for a specific taxonomy [duplicate]