Home › Forums › Bug Reports › The WP 4.8.3 update broke the query on sub field values › Reply To: The WP 4.8.3 update broke the query on sub field values
Same issue here since the 4.8.3 update, except I have not found a workaround.
$args = shortcode_atts( array(
'post_type' => 'my_menu',
'post_status' => 'publish',
'posts_per_page' => '-1',
'orderby' => 'menu_order',
'order' => 'ASC',
'season' => '',
'menu' => '',
'section' => '',
'section_title' => '',
'subtitle' => '',
'meta_query' => '',
), $atts );
// Get any parameters from the shortcode call
$season = $args['season'];
$menu = $args['menu'];
$section = $args['section'];
$section_title = $args['section_title'];
$subtitle = $args['subtitle'];
// Add query args based on ACF
if ( function_exists('get_field') ) {
// Season (checkbox)
$season_array = '';
if ( $season != '' ) {
$season_array = array(
'key' => 'season',
'value' => $season,
'compare' => 'LIKE'
);
}
// Menu (repeater)
$menu_array = '';
if ( $menu != '' ) {
$menu_array = array(
'key' => 'menu_repeater_%_menu',
'value' => $menu,
'compare' => 'LIKE'
);
}
// Section (checkbox)
$section_array = '';
if ( $section != '' ) {
$section_array = array(
'key' => 'section',
'value' => $section,
'compare' => 'LIKE'
);
}
// Output meta_query args
$meta_query = array(
'relation' => 'AND',
$season_array,
$menu_array,
$section_array,
);
$args['meta_query'] = $meta_query;
}
If I remove $menu_array from the $meta_query array, the query works (but retrieves more posts than I want, obviously). I have tested different keys for $menu_array, but nothing works.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.