Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Created April 13, 2017 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shelob9/ce99d69c00f35701371bf23dbc27a09d to your computer and use it in GitHub Desktop.
Save Shelob9/ce99d69c00f35701371bf23dbc27a09d to your computer and use it in GitHub Desktop.
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