Created
November 21, 2022 22:10
-
-
Save cliffordp/e043ad05880e1616ecfcc653935ad35b to your computer and use it in GitHub Desktop.
WordPress: Enable shortcodes everywhere
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This snippet: https://gist.github.com/cliffordp/e043ad05880e1616ecfcc653935ad35b | |
// Post Titles (including Search Results) | |
add_filter( 'the_title', 'shortcode_unautop' ); | |
add_filter( 'the_title', 'do_shortcode' ); | |
// Text Widgets | |
add_filter( 'widget_text', 'shortcode_unautop'); | |
add_filter( 'widget_text', 'do_shortcode'); | |
// Comments | |
add_filter( 'comment_text', 'shortcode_unautop'); | |
add_filter( 'comment_text', 'do_shortcode' ); | |
// Excerpts | |
add_filter( 'the_excerpt', 'shortcode_unautop'); | |
add_filter( 'the_excerpt', 'do_shortcode'); | |
// Category, Tag, and Taxonomy Descriptions | |
add_filter( 'term_description', 'shortcode_unautop'); | |
add_filter( 'term_description', 'do_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment