Created
October 8, 2018 08:18
-
-
Save espiat/1d81d2b6c41419bb131f380d42e660dd to your computer and use it in GitHub Desktop.
Caldera Forms (autopopulate ) & ACF (Field/ Meta)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filter_caldera_forms_autopopulate_post_type_args( $args, $field ) { | |
if( 'fld_3126036' === $field[ 'ID' ] ){ // your field ID !!!! | |
$args[ 'meta_query' ] = | |
array( | |
array( | |
'key' => 'status', // ACF field name | |
'value' => 'sold', // ACF field value | |
'compare' => '!=', // in this case every post is NOT sold | |
) | |
); | |
} | |
return $args; | |
}; | |
// add the filter | |
add_filter( 'caldera_forms_autopopulate_post_type_args', 'filter_caldera_forms_autopopulate_post_type_args', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment