I build custom meta box that get text and i need to know if user insert shortcode inside and convert the shortcode to his code.
for example: inside textarea user insert: Hello Word [contact-form-7 id="63" title="Contact form 1"] the textarea can get strings and html and shortcodes... the result will be: Hello Word and his form.
I build custom meta box that get text and i need to know if user insert shortcode inside and convert the shortcode to his code.
for example: inside textarea user insert: Hello Word [contact-form-7 id="63" title="Contact form 1"] the textarea can get strings and html and shortcodes... the result will be: Hello Word and his form.
Share Improve this question asked Aug 29, 2020 at 8:01 jonsjons 31 bronze badge1 Answer
Reset to default 0Shortcode won't automatically execute. I order to achieve your result you need to apply a filter. When you echo
the value of your metabox in frontend do it like this:
echo apply_filters( 'the_content', YOUR_METABOX_VALUE_HERE );
this way contact form shortcode will execute and form will show.