Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Preset a Caldera Forms field with the value of a Pods field using caldera_forms_render_get_field filter See: https://calderaforms.com/doc/caldera_forms_render_get_field/
<?php
/**
* Preset a Caldera Forms field with the value of a Pods field
*/
add_filter( 'caldera_forms_render_get_field', function( $field ) {
//Change your field ID here
if( 'fld123456' == $field[ 'ID' ] ){
//change pods() arguments, see http://pods.io/docs/code/pods/
$value = pods( 'pod-name', 42 );
$field[ 'config' ][ 'default' ] = $pods->value( 'field_name' );
}
return $field;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment