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
- Meta query with boolean true/false value
- get attachments for all posts of particular post type
- Search multiple custom fields by using meta_query
- category__in not working on custom post type
- Displaying Posts Related to Other Posts by a Taxonomy Term?
- Date query for a custom meta field
- Set default option in dropdown of WP_Query?
- Get the post permalink within the loop but without additional DB query
- Custom WP_Query not returning results when querying custom post type
- Why get_posts() not returning only selected category posts from Custom Post Type?
- How to use custom taxonomies to reference complex relationships?
- Problem querying Custom post type by custom fields
- Is it possible to store Custom Post Type data in separate set of tables and still have wp_post class functionality?
- can these 3 queries be re-written as 1 query?
- cannot override post_types in WP_Query()
- Wrapping x posts in html without leaving empty html
- Loop for custom post types filtered by a taxonomy
- Loop increase number
- Custom filter for main search: how to exclude specific post_type from search results
- Is This Code Efficient – Or is there a better way?
- Shortcode with WP_Query more than once on one page
- Can’t change posts per page in WordPress Post Type Query
- Creating a Tabbed Widget
- Using WP meta query to show custom post types by a start and finish date
- How do I list a custom field and custom taxonomies for each result in a loop?
- Wp Meta Query does not work while simple Query Works
- Display related CPT with custom taxonomy
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- Right way to store a large set of similar information on website? [duplicate]
- build child and anchestor three from post parent
- Custom query result empty on page 2
- Meta query and compare “!=” not working as expected
- Filter custom WP_Query by first letter of a custom field – hopefully using Search and Filter Pro?
- WP Query filter search. Result show all posts instead just custom post type
- Display posts of a hierarchical custom post type excluding parent posts
- get_post_meta for Custom Post Type ( CPT )
- Help ordering custom query by Title, Ascending
- How to query posts by meta keys AND under specific category?
- Shortcode display CPT Query only showing 1 post?
- How can I base a query off of the current page post type AND a meta value from another custom post type
- Pagination not working with custom loop
- Fallback if statement based on the number filtered from it
- Most efficient way of deleting post
- Problem with menu categories doubling up when updating database?
- Switched server & domain name, now custom post types won’t save
- Get images only from a certain post type
- Quering array of post types & pagination. Articles are repeating sometimes on different pages
- How can I show posts with the same tag?