Support

Account

Home Forums Front-end Issues Targeting a sub field inside a $_POST

Solved

Targeting a sub field inside a $_POST

  • Hi, how would you target a sub field inside a $_POST function? for example, ‘conditional’ is is the group field, ‘cond-options’ is its sub field:

    
    $hero = get_field('conditional');
    $pls = ( $hero['cond_options'] );
    if( $hero ):     
    
        if( isset( $_POST['weather'] ) && $_POST['weather'])
        $args['meta_query'][] = array(
        'key' => $pls,
        'value' => $_POST['weather'],
        'compare' => 'LIKE'
        );                
    endif;
    

    I tried different variations of the above, but there is something I must not understand in here.
    Short background: I have an ajax form filter that is looking into posts acf fields.

    Thanks

  • 
    'key' => 'conditional_cond_options',
    'value' => $_POST['weather'],
    'compare' => '='
    
  • Thank you, it works great for me.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Targeting a sub field inside a $_POST’ is closed to new replies.