I know this is an old question, but I thought I’d post the answer in case anybody else is facing the same problem.
functions.php:
function add_cond_to_where( $where ) {
//Replace showings_$ with repeater_slug_$
$where = str_replace("meta_key = 'showings_$", "meta_key LIKE 'showings_%", $where);
return $where;
}
add_filter('posts_where', 'add_cond_to_where');
Query:
//Replace showings_$ with repeater_slug_$
//Replace _discounts with _sub_element_slug
$args = array(
'meta_query' => array(
array(
'key' => 'showings_$_discount',
'value' => 'students',
'compare' => '='
)
)
);
Reference: https://www.advancedcustomfields.com/resources/query-posts-custom-fields
I hope this helps,
Cheers!
Related Posts:
- Linking posts together with Advanced Custom Fields “both ways”
- How to use a custom post type as front page?
- Filtering a WP_Query meta_query by numeric values isn’t working
- Querying Posts by Taxonomy From Alternate Network Site
- 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
- Query current and future events, ordered by begin date
- Having trouble with custom date field for CPT query (WordPress)
- Display posts if a custom field value is equal to another custom field value
- 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?
- Remove duplicated values from a loop
- Querying Term Posts in Loop
- Use get_post_types to query only custom posts types
- WordPress Orderby Numeric Value Not Working
- Custom Post Types not showing, custom WP_Query
- Custom Post type and Custom Field WP_Query
- Display multiple custom post types and sort them chronological by one of their fields
- convert custom query to wp_query
- Search / Filter posts on Title/Content OR Tags
- WP_Query order by custom field, then randomly order some of results
- creat filter with wp_query
- Troubles with acf/save_post and WP_Query
- Query custom post type with ACF Date
- Stuck in Order by more then one
- Order Custom Post Type by Custom Field Value
- Query Custom Post Type Taxonomy term with multiple parameters
- First custom field value (out of several) displayed twice after query
- Prioritize posts in query by meta keys?
- WP_Query orderby and tax_query
- Different Ways to Query Custom Post Types?
- Query based on custom fields start and end date
- Showing specific post in order of array wp_query
- Why is my WP Query not returning first result’s post meta?
- WP_Query() with custom post type and taxonomy — get all terms?
- Returning a custom content types with meta values
- Group by custom field value (start and end times)
- Create query for both custom post type and category
- Using WP meta query to show custom post types by a start and finish date
- Query custom posts from custom taxonomy
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- Query filter by value in meta_value array
- Change search query in wordpress custom post type
- Create if else for post types in WP_Query ‘post__in’ values
- WP Query from two Custom Post type fields as statement
- Sort custom posts by date and then by taxonomy
- WP Query: If field X is empty, show posts based on field Y
- Using ACF values in nested WP queries for CPT with date values in the past
- How select query is generated in a Custom Post Type?
- Filter posts by their related field’s custom field
- WP_Query for custom taxonomies showing posts from non-specified terms?
- How to hide sub fields in a field group and also the entire field group if the answer selected is “no”
- WP_Query with all posts in one custom post type and only posts in another custom post type with a specific category
- Wrapping an unknown amount of posts inside separate HTML Containers during WP_Query loop
- Show specific posts with WP_Query using ACF Post object
- post type => ‘any’ not applied my custom queries
- Custom Field as Custom Post type element class
- How do I display specific custom posts, and how do I edit a post’s singular page?
- Get posts of an specific term of a custom taxonomy
- Conditional posts in WP_query for search
- Query Pulling the same post twice
- Is it possible to add query parameters on the archive page?
- How to query posts by meta keys AND under specific category?
- $post breaking container loop
- Query child posts on parents single.php?
- Query Posts From Multiple Post Types
- WordPress can only query up to 766
- Custom Post-type not returning the right child_of
- Filter Custom post type by another Custom post type
- Create a list of months based posts
- Display ACF object field data using Elementor Custom Query
- WordPress WP_Query Sort by 2 dates – custom fields
- Load posts via AJAX without draft status
- get attachments for all posts of particular post type
- Displaying Posts Related to Other Posts by a Taxonomy Term?
- Custom query form submission pagination
- Paginated Taxonomy Term Archive including one post per term
- tax_query returning all posts instead of selective posts in WP_Query
- wp_query to find posts by year and month
- Custom Taxonomy terms aren’t getting referenced or saved in Quick Edit or Bulk Edit, only on Single product page?
- How do I move/order posts with a tag to the end?
- Custom WP Query on custom meta and sort by multiple meta keys value
- Woocommerce search pagination not working
- WP_Query custom post type query not showing the exact post type
- Change sort order when using ‘orderby’ => ‘type’
- How do I show a link or ‘Read More’ button on a custom field excerpt when it is less than the word limit
- Hide text if query has no posts
- Shortcode / WP_Query in post changes context
- 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
- Sort custom post column by generated value?
- Displaying all posts by category and showing content on click
- How to search through all child taxonomies using WP_Query?
- Filter custom WP_Query by first letter of a custom field – hopefully using Search and Filter Pro?
- Help ordering custom query by Title, Ascending
- Pagination not working with custom loop
- Get images only from a certain post type