Linux 软件免费装
Banner图

Dynamic text field for contact form 7

开发者 plugin999
更新时间 2026年11月27日 17:17
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

contact form 7 CF7 hidden field dynamic field shortcode field

下载

详情介绍:

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 📋 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

安装:

  1. Upload the plugin folder to /wp-content/plugins/, or install directly via the WordPress Plugins screen.
  2. Activate the plugin through the Plugins menu in WordPress.
  3. Make sure Contact Form 7 is installed and activated.
  4. Edit any CF7 form — you will see two new tag buttons: shortcodefield and shortcodehidden.
  5. Click a tag button, fill in the name and shortcode value in the popup, and click Insert Tag.
  6. Save the form and the field will dynamically resolve the shortcode value on the frontend.

屏幕截图:

  • The shortcodefield tag generator popup with name, ID, class, and shortcode value fields.
  • The shortcodehidden tag generator popup for configuring a hidden dynamic field.

升级注意事项:

1.1 Security fix for unauthenticated arbitrary shortcode execution. Update recommended. 1.0 Initial release. No upgrade steps required.

常见问题:

Does this plugin require Contact Form 7?

Yes. Contact Form 7 must be installed and activated for this plugin to work.

Can I use my own custom shortcodes?

Absolutely. Any shortcode registered in WordPress — whether from a plugin, your theme, or functions.php — can be used as the field value. Enter the shortcode name and attributes without the square brackets.

How do I pass the value in CF7 email notifications?

After inserting the tag into your form, go to the Mail tab in CF7 and insert the corresponding mail tag (e.g., [your-field-name]) into the email body or subject.

Can I use this to pass hidden tracking data?

Yes. Use the shortcodehidden tag type to insert an invisible field that captures any shortcode value — such as the current page URL, post ID, or user info — and includes it in the form submission without displaying it to the visitor.

Is the shortcodefield tag required-field compatible?

Yes. Use shortcodefield* (with an asterisk) to mark the field as required. CF7's built-in validation will prevent form submission if the field is empty.

Does it work with WooCommerce?

Yes. The DYFCF7_get_product shortcode retrieves product data and works on product pages, shop pages, cart, and checkout pages.

How do I use shortcode attributes?

Enter the shortcode without square brackets, and use single quotes for attribute values. Example: DYFCF7_get_post_title key='post_name'. Do not use double quotes inside the tag generator value field.

更新日志:

1.1 1.0