I have ACF repeater field called "courier_pricing_%_price" and trying to query the posts like this
$args = array(
'posts_per_page' => -1,
'post_type' => 'courier',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => "courier_pricing_%_price",
'compare' => ">=",
'value' => '30',
),
)
);
but it seems the "%" in the field name not working
the requested SQL is:
SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND (
( wp_postmeta.meta_key = 'courier_pricing_%_price' AND wp_postmeta.meta_value = '30' )
) AND wp_posts.post_type = 'courier' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_posts.menu_order, wp_posts.post_date DESC
it seems the line with
wp_postmeta.meta_key = 'courier_pricing_%_price'
is the problem I change the "=" to "LIKE" and test the query in PHPMyAdmin and it working fine
I used the ACF damnation https://www.advancedcustomfields.com/resources/query-posts-custom-fields/
please any help to fix this issue and many thanks in advance