Shortcode Tutorial – How To Use in Comment Box?

WordPress shortcodes are square bracket strings ([ ]) that magically transform into something fascinating on the frontend. In this tutorial we will see how to use shortcodes in comment box.

Use inside comment area [Enabling Shortcodes in Comments]

To make working shortcodes inside widget, we need to add filter.

add_filter( 'comment_text', 'do_shortcode' );

This line of filter we can add inside functions.php file or we can add inside any activated plugin.

Now, we can add any shortcode into comment box.

[h2_text] Online Web Tutor Shortcode [/h2_text] 

Above shortcode we have created in last tutorials.

Before adding filter into wordpress for comment shortcodes,

After adding above given filter into functions.php file

Sanjay KumarHello friends, I am Sanjay Kumar a Web Developer by profession. Additionally I'm also a Blogger, Youtuber by Passion. I founded Online Web Tutor and Skillshike platforms. By using these platforms I am sharing the valuable knowledge of Programming, Tips and Tricks, Programming Standards and more what I have with you all. Read more