Home / Integrations / Wordpress / Contact form 7 Dynamic Attachments using custom upload field

About The Moo Master


  1. Dear Moo Master,

    I’ve being trying your method but does not seems to be working.

    I only get the [_dynamic_attachments] shortcode in return of the email..

  2. thanks for the code,

    But it does not work for me, I’ve done it step by step and it does not work.

    I am using:


    and it does not work.

    • Hi Marcos,

      Do you receive any error when testing either [_attachment_url] or [_dynamic_attachments] ?

      • It does not show any error, the message that arrives by email does not have the link of the complete file. Only displays the [_dynamic_attachments] tag without the link.

        Here’s what I’m using:

        Plugin configured: Just Custom Fields


        Add_filter (‘wpcf7_special_mail_tags’, ‘dynamic_attachments’, 20, 3);
        Function dynamic_attachments ($ output, $ name, $ html)
           $ Name = preg_replace (‘/^wpcf7\./’, ‘_’, $ name);
           If (‘_dynamic_attachments’ == $ name) {
                $ Url = explode (‘?’, ‘Http: //’.$_SERVER [“HTTP_HOST”]. $ _SERVER [“REQUEST_URI”]);
                $ ID = url_to_postid ($ url [0]);
                $ Attachment_id = get_post_meta ($ ID, ‘_acf_uploadfield’, true);
                $ Output = wp_get_attachment_url ($ attachment_id);
           Return $ output;


        Append purchase invoice (required)
            [File * UploadResume limit: 10000000 filetypes: jpg | pdf | word | png | gif | jpeg]


        From: [your-name]
        Subject: [cf7-counter-rma]

        Message body:

        Serial number: [serie-755]
        Purchase Invoice: [UploadResume]

Leave a Reply

Your email address will not be published. Required fields are marked *