WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/no texturize shortcodes

Description

The 'no_texturize_shortcodes' filter allows you to specify which shortcodes should not be run through the wptexturize() function.

By default, WordPress will automatically texturize all post/page content, even content in shortcodes. The texturize process replaces "normal" quotes with "fancy" quotes (aka "smart" quotes, aka "curly" quotes). Sometimes this is NOT what you want... particularly if your shortcode must contain raw, preprocessed text.

Parameters

$default_no_texturize_shortcodes
(array) (required) An array of shortcodes to exempt from texturizations.
Default: array( 'code' )

Usage

This filter reveals an array of texturize-exempted shortcode names. To use the filter, simply add a new item to the array for each shortcode you want to exempt from texturization.

Examples

Do not texturize the "myshortcode" contents:

add_filter( 'no_texturize_shortcodes', 'shortcodes_to_exempt_from_wptexturize' );
function shortcodes_to_exempt_from_wptexturize( $shortcodes ) {
    $shortcodes[] = 'myshortcode';
    return $shortcodes;
}

Change Log

Since: 2.8.0

Source File

no_texturize_shortcodes is located in wp-includes/formatting.php.

Related

Shortcode API

Texturization