Title: Incompability with &#8220;do_shortcode&#8221;
Last modified: February 7, 2020

---

# Incompability with “do_shortcode”

 *  Resolved [Cèsar Martí](https://wordpress.org/support/users/cesasrgalway/)
 * (@cesasrgalway)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/incompability-with-do_shortcode/)
 * In my functions.php theme’s file, I have this code
 *     ```
       add_filter( 'wpcf7_form_elements', 'mycustom_wpcf7_form_elements' );
   
       function mycustom_wpcf7_form_elements( $form ) {
             $form = do_shortcode( $form );
             return $form;
       }
       ```
   
 * I need it to use some shortcodes within “Contact Form 7” creator. I realised 
   that “Contact Form 7 – Conditional Fields” is not working if I have that code.
   Anyone have an idea to fix it?
 * Regards.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Jules Colle](https://wordpress.org/support/users/jules-colle/)
 * (@jules-colle)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/incompability-with-do_shortcode/#post-12423265)
 * not sure what you mean exactly.. does this have anything to do with the conditional
   fields plugin?
 *  Thread Starter [Cèsar Martí](https://wordpress.org/support/users/cesasrgalway/)
 * (@cesasrgalway)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/incompability-with-do_shortcode/#post-12424858)
 * Yes. As I said, if you want to use shortcodes in Contact Form 7 you should have
   that function. But if you have it, Conditional Fields is not working.
 *  Plugin Author [Jules Colle](https://wordpress.org/support/users/jules-colle/)
 * (@jules-colle)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/incompability-with-do_shortcode/#post-12433291)
 * I’m not aware of this function, can you link me to the CF7 documentation page
   where you found this code?
 *  Thread Starter [Cèsar Martí](https://wordpress.org/support/users/cesasrgalway/)
 * (@cesasrgalway)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/incompability-with-do_shortcode/#post-12435331)
 * Hi Jules.
 * I think there’s not any official documentation, it’s just a trick that uses a
   lot of people in order to use shortcodes in CF7.
 * By default, shortcodes are not allowed in CF7. As example, if you want to use
   design shortcodes you have to use that code I said in functions.php of your theme
   folder. Another easier example… image you have a [br] shortcode that when you
   use it prints the <br> tag (it doesn’t have any sense, but it’s an easy example).
   If you write [br] in CF7, you just will have that as a text instead of <br> (
   a line break). That’s the reason to use that code with the do_shortcode function.
 * I guess the incompatibility with “Contact Form 7 – Conditional Fields” is because
   you use the functions “wpcf7_add_form_tag” or “wpcf7_add_shortcode” in “cf7cf.
   php”, but it’s just an idea.
 * I hope you can fix it.
 * Regards and thanks for the feedback.
 *  Plugin Author [Jules Colle](https://wordpress.org/support/users/jules-colle/)
 * (@jules-colle)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/incompability-with-do_shortcode/#post-12469800)
 * Hi I just tested this and it works. Make sure the shortcode exists.
 * Adding only this line to your functions.php file should suffice:
 * `add_filter( 'wpcf7_form_elements', 'do_shortcode' );`

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Incompability with “do_shortcode”’ is closed to new replies.

 * ![](https://ps.w.org/cf7-conditional-fields/assets/icon-256x256.png?rev=2072595)
 * [Conditional Fields for Contact Form 7](https://wordpress.org/plugins/cf7-conditional-fields/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cf7-conditional-fields/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cf7-conditional-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/cf7-conditional-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cf7-conditional-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cf7-conditional-fields/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Jules Colle](https://wordpress.org/support/users/jules-colle/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/incompability-with-do_shortcode/#post-12469800)
 * Status: resolved