• I was wondering if there was any official hook documentation for available hooks, more specifically for the wpcf7_before_send_mail hook. I can find information on it throughout searches but the available properties and methods are scattered at a thread here or reply there.

    I was just curious if there was one location to find all this information.

    https://wordpress.org/plugins/contact-form-7/

Viewing 3 replies - 1 through 3 (of 3 total)
  • What do you want to accomplish?

    If you want to replace email contents such as recipient, subject, body etc…

    Try using this:

    function modify_wpcf7_before_send_mail ( $components, $number ) {
    $components[ ‘recipient’ ] = “Replace the recipient”;
    $components[ ‘subject’ ] = “Replace the subject”;
    $components[ ‘body’ ] .= “Additional text”;
    return $components;

    }
    add_action(“wpcf7_mail_components”,’modify_wpcf7_before_send_mail’, 10, 2 );

    This will replace the recipient and subject you entered in the CF. Will also add new lines in body

    If you want to see what are the other things you can replace before from the form. Check the file admin-functions.php that can be found from plugins/contact-form-7/admin/includes/ and look for the function wpcf7_save_contact_form

    Hope it helps.

    Thread Starter Howdy_McGee

    (@howdy_mcgee)

    Thanks for the reply @mileu – I didn’t have anything specific I wanted to accomplish as I was able to put it together from various resources I found online. I was just curious if there was one single location where the hook documentation was so I could bookmark it for future projects.

    I think it would be nice to maybe have it on a github or the WPCF7 official website, just a page or section dedicated to it and how to access certain properties and methods.

    Rick Hellewell

    (@rhellewellgmailcom)

    I also would like an ‘official’ centralized list of Contact Form 7 hooks.

    Currently asking the googles for info, but have not found a comprehensive list.s

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hook Documentation’ is closed to new replies.