theme customizer - How to enable shortcodes in text retrieved from get_theme_mod

admin2025-06-07  50

Is there a way to enable shortcodes in text saved in the customizer and retrieved using get_theme_mod?

I'm guessing there's a filter in a similar manner to enabling shortcodes in widgets.

Is there a way to enable shortcodes in text saved in the customizer and retrieved using get_theme_mod?

I'm guessing there's a filter in a similar manner to enabling shortcodes in widgets.

Share Improve this question asked Apr 27, 2016 at 14:44 mistertaylormistertaylor 6411 gold badge6 silver badges20 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 4

To enable shortcodes in text widgets add a filter like that:

add_filter( 'widget_text', 'do_shortcode' );

You can pass every string to do_shortcode() including get_theme_mod() calls.

echo do_shortcode( get_theme_mod( 'theme_setting' ) );
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749250006a317612.html

最新回复(0)