Skip to content

Instantly share code, notes, and snippets.

@cliffordp
Created November 21, 2022 22:10
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 cliffordp/e043ad05880e1616ecfcc653935ad35b to your computer and use it in GitHub Desktop.
Save cliffordp/e043ad05880e1616ecfcc653935ad35b to your computer and use it in GitHub Desktop.
WordPress: Enable shortcodes everywhere
<?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