Skip to content

Instantly share code, notes, and snippets.

@kasparsd
Created November 15, 2018 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasparsd/91b59322d4a792b962b1740dcdc7dfdc to your computer and use it in GitHub Desktop.
Save kasparsd/91b59322d4a792b962b1740dcdc7dfdc to your computer and use it in GitHub Desktop.
Storage for Contact Form 7: Link to attachment URLs even when not sending the attachment

Replace the wpcf7_mail_components() method in src/class-cf7-storage.php with the following:

function wpcf7_mail_components( $components, $form ) {
    $submission = WPCF7_Submission::get_instance();

    if ( ! empty( $components['body'] ) && $submission ) {
        $components['body'] = $this->mail_replace_file_urls( $components['body'], $submission->uploaded_files() );
    }

    return $components;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment