Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to use a form from the Contact Form 7 plugin to allow the users to upload a document to my website. The problem is that I'd like to manage those uploads from WordPress instead of receiving them in my E-Mail.

Is there a way of redirecting the output of those forms to a PHP script, or something similar?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

Take a look at the wpcf7_before_send_mail hook CF7 provides.

add_action("wpcf7_before_send_mail", "wpcf7_do_something_else_with_the_data");
function wpcf7_do_something_else_with_the_data(&$wpcf7_data)

    // Everything you should need is in this variable

    // I can skip sending the mail if I want to...
    $wpcf7_data->skip_mail = true;

share|improve this answer
Wow, this is brilliant, exactly what I was looking for. Thank you! –  José Tomás Tocino Mar 6 '12 at 19:02

Using var_dump here is not a good idea because you will write the output to the buffer and break the form submission. Use error_log wordpress functions with print_r or var_dump with the following code instead :

ob_start();                      // start buffer capture
var_dump($wpcf7_data);           // dump the values
$contents = ob_get_contents();   // put the buffer into a variable
ob_end_clean();                  // end capture
error_log($contents);            // Write to wp-content/debug.log (enable debug mode to see it).
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.