How to allow custom shortcodes in custom widgets or in widgets in wordpress

For allow shortcodes in widgets we need to add 2 filters for render shortcodes.

1). Add below filter for remove auto p tag for widget area.. So our shortcode output will not wrapped by p tag
  add_filter( 'widget_text', 'shortcode_unautop'); 

2) .Below filter will allow widget text to rendor shortcode
add_filter( 'widget_text', 'do_shortcode', 11);

Comments

Popular posts from this blog

How to add image option in nav menu in wordpress

How to change user id on checkout page for assign order to different user in woocommerce wordpress

How to add a custom sorting or order by option on category archive or product archive page in woocommerce wordpress