Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Advanced Custom Fields - adding field data to Contact Form 7 WordPress


I'm using the [[LINK href=""]]Advanced Custom Fields[[/LINK]] plugin, the [[LINK href=""]]Contact Form 7[[/LINK]] plugin, and the [[LINK href=""]]Contact Form 7 Dynamic Text Extension[[/LINK]] plugin.

I'm trying to include the data from a custom field in the email that is sent by Contact Form 7.

I have a page with a repeater field that makes a gallery of artwork. Each artwork opens up in a modal window with a contact form 7 form in it.

The repeater field 'artist_gallery' has a sub-field, 'description' which I want to add as a hidden field to the contact form, so the receiver knows which artwork the contact form is coming from.

I've used the Contact Form 7 Text Extension plugin and it works to return the title if I use the title shortcode, but I can't get it to return the data from the custom field.

I've tried adding the field using this shortcode ([[LINK href=""]]from here[[/LINK]]):

[dynamictext dynamicname "CF7_get_custom_field key='field_4'"]

'field_4' is the field key for the 'description' custom field - [[LINK href=""]]Screenshot[[/LINK]]

But when the form comes it doesn't return anything, I've also tried putting 'description' as the key but that doesn't return anything either.

Is there something I am missing?

Answers (3)


Romel Apuya answers:


this can be easily achieve using jquery. If you can show the page that would be great.
add me on skype: rrapuya



Mike Sewell comments:

Hi Romel, you can see the site here, just click on any of the artworks for the modal window with the contact form:

Romel Apuya comments:

Hi Mike,

From the artworks which is the 'description' sub field of the repeater?

is it <p>Days of the Week -1<br>
Color woodcut<br>
15h X 11.5w in.<br>
Edition of 50</p>

for example?? or you are not displaying it?

Mike Sewell comments:

Yes, the exact section you quoted is the description.

Romel Apuya comments:

here just a theory.
add this in your functions.php
If you can give me access then i can probably make changes.

function set_to_hidden(){
<script src=""></script>
<script type='text/javascript'>
/* <![CDATA[ */
jQuery( document ).ready(function( $ ) {
$('.reveal-modal').each(function() {
var hidden_value = $(this).find('.small-12.medium-4.columns').find('p:first').html();
var regex = /<br\s*[\/]?>/gi;
hidden_value.html(str.replace(regex, "\n"));
$(this).find('.wpcf7-form').find('div:hidden:first').append('<input type="hidden" value="'+hidden_value+'" name="_description">');
/* ]]> */

Mike Sewell comments:

What do I need to add in the contact form 7 area for this to work, a placeholder of some kind?

Romel Apuya comments:

no need for other edits.


Navjot Singh answers:

Sorry. NA. Wrong answer.


Reigel Gallarde answers:

with your current setup, try this tag in your form... [dynamictext dynamicname "CF7_POST key='dynamichidden-865'"]

Mike Sewell comments:

How would that get the description field though? I tested it and it returned blank.

Reigel Gallarde comments:

add me on skype. my id is reigel99