WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7 add new attachment solution provided doesnt work (1 post)

  1. RoyBati
    Member
    Posted 1 year ago #

    Hi,

    Im trying to automatically send a file whenever someone fills the form and I came with this code from the creator of the plugin:

    add_filter( 'wpcf7_mail_components', 'mycustom_wpcf7_mail_components' );

    function mycustom_wpcf7_mail_components( $components ) {
    $components['attachments'][] = 'wp-content/uploads/2012/11/Glosario-abierto-.pdf'';
    return $components;
    }

    It doesn't work, though, with Contact Form 7 latest build. I get this error message:

    add_filter( 'wpcf7_mail_components', 'mycustom_wpcf7_mail_components' ); function mycustom_wpcf7_mail_components( $components ) { $components['attachments'][] = 'http://www.website.com/files/testni.pdf'; return $components; }
    Warning: Cannot modify header information - headers already sent by (output started at /home/expandir/public_html/wp-content/themes/ChildThemeTwentyEleven/functions.php:6) in /home/expandir/public_html/wp-includes/pluggable.php on line 881

    What im doing wrong?

    Thanks!!

Topic Closed

This topic has been closed to new replies.

About this Topic