• Resolved meldenz

    (@meldenz)


    Hello there,

    I am using both PRO version for ACF and WP Forms, and followed the guide from: https://wpforms.com/developers/how-to-create-a-smart-tag-from-an-acf-field/

    However, it’s either just displaying my custom smart tag, which is {listing_room_name}, as it is or it’s just not displaying at all.

    I have created the following:

    /* Smart Tags for WP Forms */
    /**
     * Register the Smart Tag so it will be available to select in the form builder.
     *
     * @link   https://wpforms.com/developers/how-to-create-a-smart-tag-from-an-acf-field/
     */
     
    function wpf_dev_register_smarttag( $tags ) {
      
        // Key is the tag, item is the tag name.
        $tags[ 'listing_room_name' ] = 'Listing Room Name';
      
        return $tags;
    }
     
    add_filter( 'wpforms_smart_tags', 'wpf_dev_register_smarttag' );
      
    /**
     * Process the Smart Tag.
     *
     * @link   https://wpforms.com/developers/how-to-create-a-smart-tag-from-an-acf-field/
     */
     
    function wpf_dev_process_smarttag( $content, $tag ) {
      
        // Only run if it is our desired tag.
        if ( 'listing_room_name' === $tag ) {
     
            //Get the field name from ACF
            $my_acf_field = get_field( 'listing_room_name', get_the_ID() );
     
            // Replace the tag with our link.
            $content = str_replace( '{listing_room_name}', $my_acf_field, $content );
        }
      
        return $content;
    }
     
    add_filter( 'wpforms_smart_tag_process', 'wpf_dev_process_smarttag', 10, 2 );

    I wanted to display the Listing Room Name which was a text field from ACF.

    So that visitors who submit the form know what they’re inquiring for.

    Am I missing anything based on the guide?

    Thanks.

Viewing 1 replies (of 1 total)
  • Hi @meldenz,

    We’d be happy to help!

    It seems that you are using the paid version of WPForms. If you have an active license subscription with us, could you please submit a support ticket through the WPForms account dashboard when you have a chance?

    From there, our support team will be able to take a closer look at your request.

    Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Smart Tags with ACF Field not displaying’ is closed to new replies.