Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Shelob9/034dc0f389ba02c832e64f992b6ba09d to your computer and use it in GitHub Desktop.
Save Shelob9/034dc0f389ba02c832e64f992b6ba09d to your computer and use it in GitHub Desktop.
How to set Caldera Forms field default value from ACF field. See: https://calderaforms.com/doc/caldera_forms_render_get_field/
<?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