在 Contact Form 7 字段中使用 URL 参数

Use URL parameter in Contact Form 7 Field

我想在我使用 WordPress 插件 Contact Form 7 创建的表单中添加一些 PHP。 我已经试过了,但没用:Executing PHP Code in Contact Form 7 Textarea。 每次我插入该功能时,我的网站都会崩溃。

我有一个变量存储在 $_SESSION 中。我已将该变量放入隐藏输入中,现在我想获取隐藏输入的值并将其放入联系表中。 我怎样才能做到这一点?谢谢!

Screenshot of the website and the hidden input

Screenshot of the back-end of the form

我认为这种方法适合你。

  1. 将 url 参数设置为 link。示例 domain.com/more-info?previous-link=home-page
  2. 在您的表单中添加此字段

    [text* previous-link default:get default:post_meta "Previous link"]
    

您可以在 docs

中查看更多示例