I want to use contact form 7 shortcode in advanced custom fields

I created field called shortcode with advanced custom fields and put the contact form 7 shortcode in it. it displayed the form as frontend but no functionality.

I am using the free version of advanced custom fields. also I choose the type of the field as wysewig

then here is the code

<?php echo get_field('shortcode'); ?>

I used the shortcode of contact form 7 on another page and the form worked well without using advanced custom fields. so what is the wrong, please?

********* after updating *********

<form class="getin_form wow fadeInUp" data-wow-delay="400ms" onsubmit="return false;">
            <?php echo do_shortcode(get_field('shortcode')); ?>


unfortunately can not send the link because it is on localhost. I am using xampp but this is the picture of the advanced custom fields shortcode field

enter image description here


You almost got it.

You are missing the do_shortcode function.

<?php echo do_shortcode(get_field('shorcode')); ?>

  • thanks so much for your reply. I tried your code, but it still the same problem. please note that I am using the free version of advanced custom fields. also I choose the type of the field as wysewig. is there still something wrong? – social Jul 23 '20 at 18:01
  • 1
    change it to text, only add the shorcode and it should work. wysiwyg sometimes adds html that can create some problems when using shortcodes – Buttered_Toast Jul 23 '20 at 18:03
  • @ Buttered_Toast thanks for your comment. I changed it to text field. but I am still getting the same problem – social Jul 23 '20 at 18:10
  • could you please provide a screenshot of the field with the contact form 7, the php code and a link to the page? this could help alot with tracking down the problem. Check the console as well to see what errors you get – Buttered_Toast Jul 23 '20 at 18:14
  • 1
    Remove the form tag, when using the contact form 7 shortcodes they already create the complete form, one of the elements is the form tag – Buttered_Toast Jul 23 '20 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.