Skip to content

Instantly share code, notes, and snippets.

@deckerweb
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deckerweb/b153eeb1274b4220a8e2 to your computer and use it in GitHub Desktop.
Save deckerweb/b153eeb1274b4220a8e2 to your computer and use it in GitHub Desktop.
Enable Shortcode for Text Widgets in WordPress.
<?php
/** Do NOT include the opening php tag */
add_action( 'init', 'ddw_add_shortcodes_for_text_widget', 1 );
/**
* Enable Shortcodes for Text Widgets.
*
* @author David Decker - DECKERWEB
* @link http://daviddecker.io
* @link https://gist.github.com/deckerweb/b153eeb1274b4220a8e2
*/
function ddw_add_shortcodes_for_text_widget() {
/** Add shortcode support to widgets */
if ( ! is_admin() ) {
add_filter( 'widget_text', 'do_shortcode' );
} // end if
} // end function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment