Search code examples
wordpresscontact-form-7

How, send Form title (Contact form 7 - WP Plugin) in hidden input?


Its possible send contatc form name in email body?

[contact-form-7 id="86" title="Contact form 1"]

I try the Contact Form 7 Dynamic Text Extension — WordPress Plugins, but my form are in modal items, when i click in one, show me the modal, and change the url (add -> ?id=23) but the Dynamic Text Extension only accept this field in reload page not after.

Any help?

thanks


Solution

  • I did something similar with the hidden input field and custom shortcode in functions.php. This might helps too

    wpcf7_add_shortcode('hidden', 'wpcf7_sourceurl_shortcode_handler', true);
    
    function wpcf7_sourceurl_shortcode_handler($tag) {
        if (!is_array($tag)) return '';
    
        $name = $tag['name'];
        if (empty($name)) return '';
    
        $html = '<input type="hidden" name="' . $name . '" value="' . get_the_title() . '" />';
       return $html;
    }
    

    Then add custom tag in contact form 7

    [hidden pageTitle]
    

    In email settings

    Page title is: [pageTitle]