Support

Account

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.