Skip to content

Commit 72bf988

Browse files
author
emhr
committed
Exempt shortcode from wp_texturize bypassing function priority
A safeguard against plugins who choose to filter content with wp_texturize before either SH's parse_shortcodes or parse_shortcodes_comment fires thier filters. Case in point: bbPress runs all of it's post types' content through wptexturize with a priority of 6
1 parent 4184881 commit 72bf988

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

syntaxhighlighter.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ function __construct() {
4747
add_filter( 'comment_text', array( $this, 'parse_shortcodes_comment' ), 7 ); // Comments
4848
add_filter( 'bp_get_the_topic_post_content', array( $this, 'parse_shortcodes' ), 7 ); // BuddyPress
4949

50+
// Exempt shortcodes from wp_texturize()
51+
add_filter( 'no_texturize_shortcodes', array( $this, 'no_texturize_shortcodes' ) );
52+
5053
// Into the database
5154
add_filter( 'content_save_pre', array( $this, 'encode_shortcode_contents_slashed_noquickedit' ), 1 ); // Posts
5255
add_filter( 'pre_comment_content', array( $this, 'encode_shortcode_contents_slashed' ), 1 ); // Comments
@@ -315,6 +318,12 @@ function output_shortcodes_for_tinymce() {
315318
echo "</script>\n";
316319
}
317320

321+
// A filter function that exempts shortcodes from wptexturize()
322+
function no_texturize_shortcodes( $exempted_shortcodes = array() ) {
323+
foreach ( $this->shortcodes as $shortcode )
324+
$exempted_shortcodes[] = $shortcode;
325+
return $exempted_shortcodes;
326+
}
318327

319328
// A filter function that runs do_shortcode() but only with this plugin's shortcodes
320329
function shortcode_hack( $content, $callback ) {

0 commit comments

Comments
 (0)