Skip to content
Sign in
Dynamic text field for contact form 7 icon

Dynamic text field for contact form 7

Add dynamic text and hidden fields to Contact Form 7 using shortcodes — auto-populate post, user, product, and custom field data.

Not scanned yet WordPress plugin 1k installs

Install in

No install steps yet

Follow the steps on the source page.

Dynamic text field for contact form 7 extends Contact Form 7 with two powerful new field types — shortcodefield (visible text input) and shortcodehidden (hidden input) — that automatically populate their values from any WordPress shortcode.

Stop hardcoding form values. Instead, let your CF7 forms pull live data directly from the current post, the logged-in user, a WooCommerce product, custom meta fields, or any shortcode you define.

Whether you need to pass the current page URL, the post title, or a user’s username silently in a hidden field, this plugin makes it seamless — no coding required after setup.

🔧 What You Can Do

  • Auto-populate from post data — Inject the current post’s title, slug, ID, or any post property into a form field automatically using DYFCF7_get_post_title.
  • Pull current user info — Pre-fill fields with the logged-in user’s username, email, display name, or any WP_User property using DYFCF7_get_current_user.
  • Fetch custom field (post meta) values — Retrieve any custom field value by key from the current post or a specific post ID using DYFCF7_get_custom_field key='your_key'.
  • Insert the current page URL — Pass the current page’s URL into a form field automatically using DYFCF7_page_url.
  • Access site/blog info — Pull in the site name, URL, admin email, or any get_bloginfo() value using DYFCF7_get_bloginfo.
  • Integrate WooCommerce product data — On product, shop, cart, and checkout pages, populate fields with product name, ID, price, or any product property using DYFCF7_get_product.
  • Use any custom shortcode — Not limited to built-in helpers. Pass the name of any registered shortcode (without square brackets) as the field value, and this plugin will resolve it at render time.
  • Visible or hidden output — Use shortcodefield for a visible, editable text input, or shortcodehidden for a silent hidden field — perfect for tracking metadata without showing it to users.
  • Required field validation — Mark shortcodefield as required using the asterisk variant (shortcodefield*), and CF7’s standard validation will enforce it.
  • Tag Generator UI — Both field types come with a full tag generator panel inside the CF7 form editor, complete with name, ID, class, and value inputs — no manual shortcode writing needed.

📋 Built-in Shortcodes

Shortcode
Description

DYFCF7_get_post_title key='post_title'
Get any post/page property (post_title, post_author, ID, etc.)

DYFCF7_get_current_user key='user_login'
Get any property of the currently logged-in user

DYFCF7_get_custom_field key='meta_key'
Get a custom field (post meta) value by key

DYFCF7_page_url
Get the URL of the current page

DYFCF7_get_bloginfo show='name'
Get site info (name, URL, admin_email, etc.)

DYFCF7_get_product key='name'
Get WooCommerce product data on product pages

💡 How It Works

In the CF7 form editor, click the shortcodefield or shortcodehidden tag button. In the popup, enter a shortcode name — without the square brackets — into the value field. For example, to pre-fill a field with the current post title, enter:

DYFCF7_get_post_title key='post_title'

The plugin resolves the shortcode on page load and injects the result as the field’s value. You can also pass any custom shortcode you have registered in your theme’s functions.php.

🔗 Resources

Written by Joobi from the project's own listing. See the source page

cf7contact form 7dynamic fieldhidden fieldshortcode field
27 Nov 2026
Version 1.1 released. Not scanned yet.

1.1

  • Security: fixed unauthenticated arbitrary shortcode execution. Submitted/hangover values are never passed to do_shortcode(); only the shortcode configured by the form author is executed.
  • Security: hidden shortcode fields ignore submitted values on re-render.
  • Security: built-in shortcodes (post title, current user, custom field, product) now use key allowlists; custom field shortcode checks post status, password and read permission.
  • Hardening: validation checks isset() and uses wp_unslash() before sanitizing.

1.0

  • Initial release.
  • Added shortcodefield tag type — a visible, editable text input populated via shortcode.
  • Added shortcodehidden tag type — a hidden input populated via shortcode.
  • Built-in shortcodes: DYFCF7_get_post_title, DYFCF7_get_current_user, DYFCF7_get_custom_field, DYFCF7_page_url, DYFCF7_get_bloginfo, DYFCF7_get_product.
  • Tag Generator UI for both field types in the CF7 form editor.
  • Required field validation support for shortcodefield*.
25 May 2022Listed on Joobi from WordPress.org.

Follow this listing's changes (Atom feed)