Created
May 2, 2017 19:09
-
-
Save Shelob9/642e30675ede154f180c40199acb7b26 to your computer and use it in GitHub Desktop.
Get all field IDs or field slugs or field labels from a Caldera Form
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 | |
/** | |
Get all field IDs or field slugs or field labels from a Caldera Form | |
*/ | |
//Get form config | |
$form = Caldera_Forms_Forms::get_form( 'CF58c1e0a4d7c27' ); | |
//Get all fields in order | |
$fields = Caldera_Forms_Forms::get_fields( $form, true ); | |
//reduce to just field IDs | |
$field_ids = array_keys( $fields ); | |
//reduce to just field slugs | |
$field_slugs = wp_list_pluck( $fields, 'slug' ); | |
//reduce to just field labels | |
$field_labels = wp_list_pluck( $fields, 'label' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment