From b4b0efe7019236ae1a29ade464e3cafbc51ed09d Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 10 Jun 2014 01:46:14 +0000 Subject: [PATCH] Add a `$run_texturize` static var to `wptexturize()` that is filterable via a new run-once filter: `'run_wptexturize'`. Allows user to disable texturization. Needs filter docs. Props nacin, SergeyBiryukov. See #19550. Built from https://develop.svn.wordpress.org/trunk@28715 git-svn-id: http://core.svn.wordpress.org/trunk@28529 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 9292ee1762..d8f78d1556 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -29,10 +29,19 @@ function wptexturize($text) { global $wp_cockneyreplace; static $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements, - $default_no_texturize_tags, $default_no_texturize_shortcodes; + $default_no_texturize_tags, $default_no_texturize_shortcodes, $run_texturize = true; + + if ( false === $run_texturize ) { + return $text; + } // No need to set up these static variables more than once if ( ! isset( $static_characters ) ) { + $run_texturize = apply_filters( 'run_wptexturize', $run_texturize ); + if ( false === $run_texturize ) { + return $text; + } + /* translators: opening curly double quote */ $opening_quote = _x( '“', 'opening curly double quote' ); /* translators: closing curly double quote */