Contact form 7 email subject should be post title

Tanvir picture Tanvir · Jun 3, 2015 · Viewed 7.5k times · Source

I am using custom form 7

I want that, If anyone clicks the mail button under single post in wordpress, it will automatically redirect him to contact-us page and then subject of the mail will be the post title.

How can I do that?

Answer

Irvin Lim picture Irvin Lim · Jun 3, 2015

Haven't used it before, but this plugin claims to work for your purposes: https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/

You will then create your mail link to contain the post title via a query parameter with (maybe with http_build_str()), so that your URL becomes like:

http://example.com/contact-us/?title=my+post+title

After which you have to create the new CF7 tag as such, to auto-populate with the $_GET variable.

[dynamictext post_subject "CF7_GET key='title'"]