Skip to content

Instantly share code, notes, and snippets.

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/313159cd1edc68ab8ae98588bddde808 to your computer and use it in GitHub Desktop.
Save Shelob9/313159cd1edc68ab8ae98588bddde808 to your computer and use it in GitHub Desktop.
Code examples for caldera_forms_easy_pods_autopopulate_label_field filter. See: https://calderaforms.com/doc/caldera_forms_easy_pods_autopopulate_label_field/
<?php
/**
* Change which Pods field is used for the label of a Caldera Forms field autopopulated with the results of an Easy Pods query if Pod is a user Pod.
*/
add_filter( 'caldera_forms_easy_pods_autopopulate_label_field', function( $label_field, $form, $pod, $easy_pod ){
if( function_exists( 'cep_pod_type' ) && 'user' == cep_pod_type( $pod ) ){
$label_field = 'display_name';
}
return $label_field;
}, 10, 4 );
<?php
/**
* Change which Pods field is used for the label of a Caldera Forms field autopopulated with the results of an Easy Pods for a specific Easy Pod.
*/
add_filter( 'caldera_forms_easy_pods_autopopulate_label_field', function( $label_field, $form, $pod, $easy_pod ){
if( 'fancy-search' == $easy_pod['slug'] ){
$label_field = 'slug_of_pods_field';
}
return $label_field;
}, 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment