Premium
Snippet

Pre-fill Fluent Forms Fields via Custom Attributes

This is a premium 
Snippet

To view the whole 
Snippet
, subscribe to SnippetNest ($99/year) and unlock access to all my premium
Snippet
s OR get access to just this 
Snippet
for only $!

If you’re using Fluent Forms and need to dynamically populate form fields based on context (like a specific service page or user action), this snippet lets you pass values directly through the form’s shortcode using custom attributes. Simply add prefill_ before your field name and provide the value you want to pre-populate.

This is especially useful when you’re embedding the same form across multiple pages but want to customize the default values based on context, without creating separate forms for each scenario.

Example Use Case

Let’s say you have a “Services” form and you want to pre-select a service based on which page the user is viewing. Your shortcode would look like this:

[fluentform id="2" prefill_service="Web Design"]

In this example, since your form has a field named service , it will automatically be populated with “Web Design” when the form loads. You can add as many prefill_ attributes as you need, one for each field you want to populate.

On to the Code!

Blurred PHP code block

Table of Contents

  • Example Use Case
  • On to the Code!

Language

PHP

Purchase this
Snippet

Get access to this
Snippet
for just $

Purchase this snippet

Purchase Snippet + User Registration
Apply Coupon
Price: $10.00

Sign up for SnippetNest

Get access to everything for $99/year