Frustration sets in when software starts being too smart especially when you are not expecting it to.
The WordPress function wptexturize
transforms quotes to smart quotes, apostrophes, dashes, ellipses, the trademark symbol, and the multiplication symbol.
Characters | Transformed to | 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 |
I was sharing code in a bbPress forum and it would convert a double dash to an em-dash. Here’s how I disabled wptexturize completely from the site.
add_action('after_setup_theme', 'ag_setup', 5);
function ag_setup(){
// Remove wptexturize from WordPress
remove_filter( 'bloginfo' , 'wptexturize' );
remove_filter( 'comment_author' , 'wptexturize' );
remove_filter( 'comment_text' , 'wptexturize' );
remove_filter( 'link_description' , 'wptexturize' );
remove_filter( 'link_name' , 'wptexturize' );
remove_filter( 'link_notes' , 'wptexturize' );
remove_filter( 'nav_menu_attr_title' , 'wptexturize' );
remove_filter( 'nav_menu_description' , 'wptexturize' );
remove_filter( 'single_cat_title' , 'wptexturize' );
remove_filter( 'single_month_title' , 'wptexturize' );
remove_filter( 'single_post_title' , 'wptexturize' );
remove_filter( 'single_tag_title' , 'wptexturize' );
remove_filter( 'term_description' , 'wptexturize' );
remove_filter( 'term_name' , 'wptexturize' );
remove_filter( 'the_excerpt_embed' , 'wptexturize' );
remove_filter( 'the_post_thumbnail_caption' , 'wptexturize' );
remove_filter( 'widget_text_content' , 'wptexturize' );
remove_filter( 'widget_title ' , 'wptexturize' );
remove_filter( 'wp_title' , 'wptexturize' );
// Remove wptexturize from bbPress
remove_filter( 'bbp_get_reply_content', 'wptexturize', 6);
remove_filter( 'bbp_get_topic_content', 'wptexturize', 6);
}