If you haven’t already, please install the plugin before proceeding.
The Contact Form 7 Dynamic Text Extension adds two new “form tags” to Contact Form 7 – dynamic text and dynamic hidden. They appear beside the other tags when editing a Contact Form 7 form
Adding a dynamic field
Let’s walk through an example of adding a dynamic text field to a form to insert the current user’s name to demonstrate what the DTX does.
1. Set up your basic form
You can create a new form or edit an existing form. In this case, we’ll create a new form as an example. Here’s the default Contact Form 7 form:
We’ve added it to a page:
published, that page, and can view the form on the front end
2. Find a field to replace, or add a new field
In this case, let’s make the Your Email field dynamic.
Now out of the box, we could set a default value for the text field
and that would appear on the front end.
But since not everyone is named Jim, that’s not very helpful.
Instead, we want to replace this with the current user’s name. So we’ll replace the original “text” field with a “dynamictext” field instead.
3. Adding a dynamic field
We’ll click the “dynamic text” button to add a new dynamic field
We want it to be required, and we’ll name the field “your-name”.
4. Setting the Dynamic value
This is the key to getting the current user’s name dynamically inserted into the form.
In the dynamic value field, we can add any shortcode we like. In this case, we’ll use the included
CF7_get_current_user shortcode. Let’s fill the field with the user’s display name, so we’ll use
Note that the square brackets
 are omitted, and we use single quotes
' rather than double quotes
". Please see Shortcodes for more information.
5. Insert the tag
We click “Insert Tag” and the final Your Name field will look like this
Then click “Save” to save the form.
On the front end, the form will now be pre-filled with the user’s name for logged in users