Shortcode Tutorial – How To Use in Comment Box?

Share this Article

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

Was this post helpful?

Learn Web Development Courses Risk Free @ $5 only.
Web Development Courses @ $5