Created
April 13, 2017 16:49
-
-
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/
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 | |
/** | |
* 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