Search code examples
wordpresscontact-form-7

How to get the contact form only by passing the ID of contact form 7?


I need to develop an addon in visual composer in such a way that I will pass only ID for the contact form and I need to show the form for the same. So kindly let me know the answer for it.


Solution

  • All you need is to pass only id in the contact form Shortcode if you are getting the id you can pass it directly into shortcode as below:

    <?php echo do_shortcode('[contact-form-7 id="'$id.'" ]');?>
    // assuming that $id is your contact form id