Created
September 16, 2019 12:09
-
-
Save yanknudtskov/c8fbe3ca08c25b4a6832945660c37d11 to your computer and use it in GitHub Desktop.
Process shortcodes in Gravity Forms field labels
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 | |
/** | |
* Process Shortcodes in Gravity Forms field labels | |
*/ | |
define( 'ACF_GRAVITY_FORM_ID', 1 ); // The ID of the form to process | |
add_filter( 'gform_pre_render_' . ACF_GRAVITY_FORM_ID, 'yanco_process_shortcodes_gravityforms_field_labels' ); | |
function yanco_process_shortcodes_gravityforms_field_labels( $form ) { | |
foreach( $form['fields'] as &$field ) { | |
$field->label = do_shortcode( $field->label ); | |
} | |
return $form; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment