You can use meta_query
property when fetching post data using new WP_Query()
$vehicles = new WP_Query([
'post_type' => 'vehicle',
'meta_query' => [
'relation' => 'AND',
[
'key' => 'wheel',
'value' => '4',
],
[
'key' => 'color',
'value' => 'blue',
]
]);
Related Posts:
- WP_Query orderby and tax_query
- How to use a custom post type as front page?
- Querying Posts by Taxonomy From Alternate Network Site
- Custom Search | Wrong output & question
- Query by 2 values of a repeater ACF field
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Include both default and Custom Post Type in query modified inside pre_get_posts
- How to use custom post type APIs, but use a different db table
- Having trouble with custom date field for CPT query (WordPress)
- WP_Query search posts by custom post type and custom taxonomy
- Calculating Bayesian average for custom post type
- Conditional to modify query results
- Is it possible to create a shortcode that will query a post based on taxonomies?
- Querying Term Posts in Loop
- Use get_post_types to query only custom posts types
- WordPress Orderby Numeric Value Not Working
- wpdb custom post_type problem
- convert custom query to wp_query
- Search / Filter posts on Title/Content OR Tags
- creat filter with wp_query
- First custom field value (out of several) displayed twice after query
- Prioritize posts in query by meta keys?
- Different Ways to Query Custom Post Types?
- How to organise this data within WordPress
- Showing specific post in order of array wp_query
- WP_Query() with custom post type and taxonomy — get all terms?
- Returning a custom content types with meta values
- Create query for both custom post type and category
- Query custom posts from custom taxonomy
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- Change search query in wordpress custom post type
- WP Query from two Custom Post type fields as statement
- WP Query: If field X is empty, show posts based on field Y
- Does this archive template part look like its making too many calls to the db?
- WP_Query for custom taxonomies showing posts from non-specified terms?
- WP_Query with all posts in one custom post type and only posts in another custom post type with a specific category
- post type => ‘any’ not applied my custom queries
- Linking posts together with Advanced Custom Fields “both ways”
- Get posts of an specific term of a custom taxonomy
- Conditional posts in WP_query for search
- CPT or Custom Table for Repository of Serial Numbers
- Query Pulling the same post twice
- Is it possible to add query parameters on the archive page?
- Use Tags to Query Associated Multiple Posts and Get The Average Of Custom Field Values
- Query child posts on parents single.php?
- Query Posts From Multiple Post Types
- WordPress can only query up to 766
- Filter Custom post type by another Custom post type
- Create a list of months based posts
- WordPress Admin Page Slow. Customer Post Type is the slowest
- Load posts via AJAX without draft status
- Query Multiple Post Types and Paginate Newly Created List
- Custom Post Type Archive Pagination
- Query Posts that have Custom Taxonomy
- Display post from custom post type
- Database alteration: users who voted
- WordPress as a frontend website for iOS app [closed]
- Custom Plugin – Query CPT – Display Results
- List all Custom Post Type posts excluding certain Taxnomy term
- Running a custom query inside another cpt single and trying to grab a variable
- Searching post types
- Function to limit number of custom post types on homepage – TwentyTen
- Get posts by category name
- Query Posts, order by meta value
- WP_Meta_Query object with conditionals
- WP_Query: Posts within category OR custom post type
- foreach loop inside the loop creating duplicates in output
- list posts of two post types in a single template
- Sorting by meta_key different to search criteria?
- Custom taxonomy query showing more than 4 posts
- Shortcode / WP_Query in post changes context
- Using WP meta query to show custom post types by a start and finish date
- Two queries – one with checkbox ticked, one without – comparing meta_query
- Custom types, taxonomies and query optimization
- Foreach loop returning more than one item when querying taxonomy
- How to properly use Categories with Custom Post Types
- Using custom post types WordPress network
- Getting titles from an array of IDs
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- wp_query not returning my custom post
- delete duplicate meta_value with same post_id
- Problem while filtering by ‘category_name’
- All blog posts are not showing up
- Query Custom Post by taxonomy multiple categories
- custom post type: own database table structure and custom “new-post” interface
- How to fetch posts that are stored in the different table than (default) wp_posts?
- WP_Query of a custom post type isn’t working
- WP_Query order custom post type with certain meta key value by post modified date
- Cant’ Display Custom Post Type Title Base on Tax Terms
- wp_dropdown_pages with tax_query clause
- Cache issue with WP_Query and custom field filtering
- Post Type => Any conundrum
- Import External XML
- Custom Post type showing up in loop, regular posts are not showing up
- All in one calendar custom post type query doesnt work as expected
- filter the_content, custom post type, and wp_query
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- Displaying Portfolio Filter by Category Order (alphabetically)
- Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php