I am working on a site built in visual composer/wp bakery. I do not want to work in the admin but in a php file.

How can I get code like

<h3><a href="home">home</a></h3>

to parse from a a php file, rather than WP admin?

  • Those are shortcodes, it'll make more sense and be much easier to search if you think of them as VC shortcodes rather than VC code
    – Tom J Nowell
    Mar 26, 2018 at 18:05
  • Why use Visual Composer at all if you want to write the code? Seems to defeat the purpose. Mar 27, 2018 at 0:10
  • because the site is written in visual composer. I am just working with it. If I deactivate the plugin it does not make HTML code but errors.
    – Jon
    Mar 27, 2018 at 8:04

2 Answers 2


Based on Toms comment this will work:

<?php echo do_shortcode( ' 
<h3><a href="home">home</a></h3>
' );?>
  • If anyone else is struggling with this, here's a solution that worked for me: wordpress.stackexchange.com/a/230092/9041
    – rereradu
    Apr 17, 2019 at 20:35
  • Hey, I am having an issue with the do_shortcode function, I am getting all content of post containing the visual composer shortcode, I have called the function like this:: do_shortcode(get_the_content()) but gives me an output like:: [vc_row][vc_column] content ..... [/vc_row][/vc_column] Aug 12, 2019 at 6:31
  • I don't want to show these tags with content. Aug 12, 2019 at 6:32
  • I dont fully understand your case but you need to activate the visual composer/wp bakery plugin in admin, then the [vc_row] will be parsed by that plugin. If you do not want to use the plugin, you have to rewrite all the code
    – Jon
    Aug 16, 2019 at 9:44

You can just try this function WPBMap::addAllMappedShortcodes(); and the shortcodes will disappear!

  • 2
    This may be a good answer to a different question, but the idea is to execute the shortcode, not to remove it
    – Jon
    Jan 22, 2020 at 14:49

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.