Created
May 5, 2017 18:10
How to set Caldera Forms field default value from ACF field. See: https://calderaforms.com/doc/caldera_forms_render_get_field/
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
<?php | |
/** | |
* Set Caldera Forms Field default from ACF field | |
*/ | |
add_filter( 'caldera_forms_render_get_field', function( $field ) { | |
//Change your field ID here | |
if( 'fld123456' == $field[ 'ID' ] ){ | |
$field[ 'config' ][ 'default' ] = get_field( 'field_name' ); | |
} | |
return $field; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment