### [wpforms_smart_tag_process](https://wpforms.com/developers/wpforms_smart_tag_process/)

**Published:** February 17, 2021
**Author:** Editorial Team

**Excerpt:** The wpforms_smart_tag_process filter is used to process all Smart Tags inside the WPForms form builder.

**Content:**

## Description

The `wpforms_smart_tag_process` filter used to process Smart Tag(s) inside the WPForms form builder.

## Parameters

$content*(string) (Required)* Content of the Smart Tag.$tag*(string) (Required)* Tag name of the Smart Tag.## Source

`wpforms/includes/class-smart-tags.php`

## More Information

The filter is used to create, define and register Smart Tag(s) to be used inside the WPForms form builder.

Using this filter must also be accompanied by the `wpforms_smart_tags` that would register the Smart Tag prior to processing it.

## Example

```

/**
 * Process the Smart Tag.
 *
 * @link    https://wpforms.com/developers/wpforms_smart_tag_process/
 *
 * @param   string   $content  Content of the Smart Tag.
 * @param   string   $tag      Tag name of the Smart Tag.
 * @return  string
 */

function wpf_dev_process_smarttag( $content, $tag ) {
 
    $userID = get_current_user_id();
 
    // Only run if it is our desired tag.
    if ( 'wp_nickname' === $tag ) {

        $wp_nickname = get_the_author_meta( 'nickname', $userID );

        // Replace the tag with the nickname pulled from the user's WordPress profile.
        $content = str_replace( '{wp_nickname}', $wp_nickname, $content );

    }

        if ( 'wp_username' === $tag ) {

        $wp_username = get_the_author_meta( 'user_login', $userID );

        // Replace the tag with the username pulled from the user's WordPress profile.
        $content = str_replace( '{wp_username}', $wp_username, $content );

    }
 
    return $content;
}

add_filter( 'wpforms_smart_tag_process', 'wpf_dev_process_smarttag', 10, 2 );

```

## Reference Articles

- [How to Create a Custom Smart Tag](https://wpforms.com/developers/how-to-create-a-custom-smart-tag/ "How to Create a Custom Smart Tag")
- [How to Create a Smart Tag for the Current Time](https://wpforms.com/developers/how-to-create-a-smart-tag-for-the-current-time/ "How to Create a Smart Tag for the Current Time")
- [How to Create a Unique ID for Each Form Entry](https://wpforms.com/developers/how-to-create-a-unique-id-for-each-form-entry/ "How to Create a Unique ID for Each Form Entry")
- [How to Create More User Smart Tags](https://wpforms.com/developers/how-to-create-more-user-smart-tags/ "How to Create More User Smart Tags")
- [How to Include Post Submissions Post URL in the Confirmation Message](https://wpforms.com/developers/how-to-include-post-submissions-post-url-in-the-confirmation-message/ "How to Include Post Submissions Post URL in the Confirmation Message")
- [How to Create a Smart Tag from an ACF Field](https://wpforms.com/developers/how-to-create-a-smart-tag-from-an-acf-field/ "How to Create a Smart Tag from an ACF Field")
- [How to Create a Smart Tag Domain URL](https://wpforms.com/developers/how-to-create-a-smart-tag-domain-url/ "How to Create a Smart Tag Domain URL")

**Categories:** Filters Hooks

**Tags:** PHP

---

