WPForms comes with many pre-built smart tags, which are like shortcodes for your form. You can also add your own.
The following code will turn {my_smart_tag}
into “Testing 1 2 3”. You can replace the tag name and value with whatever you’d like to use.
/**
* Custom Smart Tags
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/wpforms-custom-smart-tags
*/
function ea_custom_smart_tags( $content, $tag ) {
if( 'my_smart_tag' == $tag ) {
$value = 'Testing 1 2 3';
$content = str_replace( '{' . $tag . '}', $value, $content );
}
return $content;
}
add_filter( 'wpforms_smart_tag_process', 'ea_custom_smart_tags', 10, 2 );