Answer the question
In order to leave comments, you need to log in
How to pass a string from ACF to wp_query?
I have an ACF repeater where I created 2 lines (all posts have 2 lines or more):
1 line: [name | age | city ]
2nd line: [name | age | city ]
I want to pass the city field of 2 lines to wp_query. How can this be done?
My code is like this but it doesn't work :(
$rows = get_field('days_duration');
$first_row = $rows[0];
$cost_per_day = $first_row['cost_per_day' ]; // получаю в переменную ту самую строку и поле city.
$args = array(
'post_type' => 'ration',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_key' => $rows, // передаю сам acf
'meta_value' => $cost_per_day, // передаю вот то самое поле
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question