Languages: English • Italiano • 日本語 • (Add your language)
This returns given text with transformations of quotes to smart quotes, apostrophes, dashes, ellipses, the trademark symbol, and the multiplication symbol.
Text enclosed in the tags <pre>, <code>, <kbd>, <style>, <script>, and <tt> will be skipped. This list of tags can be changed with the 'no_texturize_tags' filter.
Text in the '[code]' shortcode will also be ignored. The list of shortcodes can be changed with the 'no_texturize_shortcodes' filter.
The entire function can be turned off with the 'run_wptexturize' filter.
Do not use this function before the 'init' action hook. All of the settings must be initialized before the first call to wptexturize or it will fail on every subsequent use.
<?php wptexturize( $text ); ?>
Opening and closing quotes can be customized in a WordPress translation file. Here are some of the text transformations:
| source text | transformed text | symbol name |
|---|---|---|
| "---" | "—" | em-dash |
| " -- " | "—" | em-dash |
| "--" | "–" | en-dash |
| " - " | "–" | en-dash |
| "..." | "…" | ellipsis |
| `` | “ | opening quote |
| "hello | “hello | opening quote |
| 'hello | ‘hello | opening quote |
| '' | ” | closing quote |
| world." | world.” | closing quote |
| world.' | world.’ | closing quote |
| " (tm)" | " ™" | trademark symbol |
| 1234" | 1234″ | double prime symbol |
| 1234' | 1234′ | prime symbol |
| '99 | ’99 | apostrophe before abbreviated year |
| Webster's | Webster’s | apostrophe in a word |
| 1234x1234 | 1234×1234 | multiplication symbol |
There is a small "cockney" list of transformations, as well. They can be replaced if the variable $wp_cockneyreplace is defined and contains an associative array with the keys containing the source strings and the values containing the transformed strings. By default the following strings will be transformed:
Since: 0.71
In 4.0: wptexturize() and _wptexturize_pushpop_element() were significantly revised to improve performance and to resolve many bugs. This version also added the run_wptexturize filter to allow a theme or plugin to permanently disable this feature.
wptexturize() is located in wp-includes/formatting.php.