1. Home
  2. Snippets
  3. Process Smart Tags in checkbox choice labels

Process Smart Tags in checkbox choice labels

Heads up!

This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

For extra guidance, please see WPBeginner's tutorial on adding custom code.


Smart Tags are a great way to dynamically pull and display data within your form. Additionally, custom Smart Tags can be created to extend this functionality much further.

By default, however, Smart Tags will not be processed if placed within option labels for a Checkboxes field.

To process any Smart Tags included within Checkboxes field choices, you can copy the code below into your site.

 * Process smart tags inside checkbox choice labels
 * @param array $field
 * @param array $deprecated
 * @param array $form_data
 * @return array
function wpf_dev_checkbox_choices_process_smarttags( $field, $deprecated, $form_data ) {
	foreach ( $field['choices'] as $key => $choice ) {
		if ( ! empty( $choice['label'] ) ) {
			$field['choices'][ $key ]['label'] = apply_filters( 'wpforms_process_smart_tags', $choice['label'], $form_data );
	return $field;
add_filter( 'wpforms_checkbox_field_display', 'wpf_dev_checkbox_choices_process_smarttags', 10, 3 );
Updated on April 30, 2019

Was this article helpful?