WPForms Custom Smart Tags

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 );

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk