Support

Account

Home Forums General Issues Get all posts that have at least one value in a group Reply To: Get all posts that have at least one value in a group

  • Well, yes it would be possible, but it’s probably going to cause performance issues with the query, it might event time out your site. You need to check every value.

    group sub field meta keys are as follows

    
    "{$group_field_name}_{$sub_field_name}"
    

    nested group fields

    
    "{$group_field_name}_{$nested_group_field_name}_{$sub_field_name}"
    
    
    $args = array(
      'cat'             => 3,
      'post_type'			  => 'post',
      'posts_per_page'  => $atts['partite'],
      'meta_query' 		  => array(
        'relation'      => 'AND',
        array(
            'key'			  => 'data_match',
            'compare'		=> '>=',
            'value'			=> date_i18n('Y-m-d H:i'),
            'type'			=> 'DATETIME'
        ),
        array(
          'relation' => 'OR',
          array(
            'key' => 'meta_key',
            'value' => ''
            'compare' => '!='
          ),
          // repeat the above array for every field you want to check
        ),
      ),
      'order'     => 'ASC',
      'orderby'  => 'meta_value',
      'meta_key' => 'data_match',
    );