最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

To know whether insert shortcode in custom meta box

programmeradmin0浏览0评论

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 badge
Add a comment  | 

1 Answer 1

Reset to default 0

Shortcode 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.

发布评论

评论列表(0)

  1. 暂无评论