I’m trying to dynamically attach a PDF dependent on the post the user is on. Each post allows the user to upload an attachment (PDF) using the advanced custom field plugin.
If the user populates a simple form (name, email address) on the specific post it should automatically add the attachment to the email.
I’ve been receiving the email but with NO attachment. Anyone help?
The house_plan_attachment gets the url of the attachment.
function my_dynamic_attachments($cf7)
{
if ($cf7->id==195)
{
$submission = WPCF7_Submission::get_instance();
$url = $submission->get_meta( 'url' );
$postid = url_to_postid( $url );
$filename = get_field('house_plan_attachment' , $postid);
$cf7->uploaded_files = array('Attachment'=>$filename);
}
}
https://wordpress.org/plugins/contact-form-7/