As said in comments, you should use meta_query
.
For help on how to query posts by ACF meta field, you can check the ACF documentation:
https://www.advancedcustomfields.com/resources/query-posts-custom-fields/
$args = array(
'numberposts' => -1,
'post_type' => 'event',
'meta_key' => 'location',
'meta_value' => 'Melbourne'
);
// query
$the_query = new WP_Query( $args );
Related Posts:
- date_query empty results with custom post type
- How to use a custom post type archive as front page?
- Combining queries with different arguments per post type
- How do you get the count of posts in an archive page?
- Mixing regular and custom post types (with meta_query) on home page
- How to make a WP_Query search with custom post types?
- $wp_query->queried_object->ID throws warning: Undefined property
- how to filter by last name for custom post
- The Operator “NOT IN” Does Not Work In tax_query
- Display Custom Post Type Fields
- Use WP_Query object inside a function
- Get posts with tag all post types
- How to get_queried_object on multiple objects?
- How to get the parent’s taxonomy?
- WordPress query by multiple Custom fields and order by date
- Help with hierarchical custom taxonomies and permalinks…almost there
- New WP_query in template not working with CPT+category on some pages
- query order by date on custom type: wrong order
- Displaying a specific post in a wp query by post id
- Query current and future events, ordered by begin date
- Query custom post types and a specific page?
- Optimised Code for Pulling Taxonomy Posts
- Calculating Bayesian average for custom post type
- Help with CPT template pagination
- How can I get the first 50% of all posts (within a custom post type)?
- Custom query shows custom post types in trash
- Remove duplicated values from a loop
- Fetch taxonomies by custom post type id array
- is there a way to retrieve posts that do not have a featured image assigned?
- How to connect two custom post types with nested loops
- Custom Post type and Custom Field WP_Query
- Related posts in all categories of current post (custom post types)
- Why does querying on post_tags (which has been applied to custom post types) only return posts?
- How to show CPTs in term archive
- shortcode to show custom post types by category
- Query/list all terms and their custom post count
- Genesis filterable portfolio isotope [closed]
- convert custom query to wp_query
- Get custom taxonomies from multiple posts
- Pagination on with query_posts in custom post type template
- Loop to fetch 3 post_thumbnail instances from 3 most recent custom post types named “portfolio”
- Custom post ui plugin & WP_Query – Polylang
- How to use load more custom post type data normal or according to on click category tab In WP
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Polylang non-default language ignores tags in WP_Query
- Problem: wp_query outputs all images on site
- wp_reset_postdata() and wp_reset_query() inside shortcode are not working to reset original page query
- How does order=asc effect a wp_query (its acting pretty weird in a loop)
- Why is my WP_Query outputting my entries twice?
- How to display Related Posts based on number of taxonomy terms matched
- Using wp_query to modify the loop in index.php for a CPT
- Custom WP_Query doesn’t display all posts
- WP_Query() with custom post type and taxonomy — get all terms?
- Query & the_content() is showing in the header
- Variable not working in WP_Query
- Wp Query with multiple custom tag(taxonomy) by get the terms
- Pagination not working on custom query on a page
- Query within a foreach within a query (queryception)
- How to get Custom Post Type with Categories wise in WordPress using wp_query
- Post ordering not working with custom field
- WP_Query of a custom post type isn’t working
- Query custom posts from custom taxonomy
- Query Custom Post Type by Taxonomy
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- Related “custom post type” using “custom taxonomy”
- Page that lists publications by classifying them by taxonomy
- Exclude a specific post in a Custom Post Type
- Random item on Custom Query working Local but not on live
- Filtering posts based on three taxonomies
- wp_post_delete is deleting all offices
- How can I get custom post types to recognize pretty permalink variables?
- Error in the page of a CPT file in WordPress
- How to display grandchildren only of custom post?
- Sort custom post archives by a meta value from a different custom post type?
- post type => ‘any’ not applied my custom queries
- One of my headings is mysteriously coming up as a link in my CPT Archive
- Query the title of the page to show posts with matching category in the loop
- WP Query tax_query not returning posts
- The most recent post of custom taxonomy
- Display child posts from a certain category
- Problems with the WP_Query query for a Custom post type
- wp_query return nothing
- Custom post type and custom taxonomies display
- WordPress custom post type
- Custom Post ‘Post Per Page’ Crashing Page?
- Custom post type single display is ommited
- Issue with permalinks for custom post type
- Paged within a custom content type template [duplicate]
- WordPress can only query up to 766
- Custom Post Query Combined with Conditional Tags
- Custom loop won’t work, can’t find problem
- Query by post type or category
- Get all custom_post_type posts + blog posts from one category in a single query
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- How to exclude certain portfolios from a loop
- show the most recent date of all posts to display on front end
- Quering array of post types & pagination. Articles are repeating sometimes on different pages
- How can I show posts with the same tag?
- Load posts via AJAX without draft status
- WP Query – Can’t get posts with specific taxonomy