WordPress: Tired of Dashes and Quotes Being Rewritten?

Posted on in Software

Using WordPress to write a technical blog can be occasionally frustrating. WordPress uses the wptexturize() function to rewrite certain ASCII character combinations into HTML entities. Although this may generally be a "good thing," it's really annoying on technical blogs where two dashes is not an em dash.

To disable this feature, I've followed jidanni's suggestion and added the following code to my theme's functions.php:

 foreach( array(
    'bloginfo',
    'comment_author',
    'comment_text',
    'link_description',
    'link_name',
    'link_notes',
    'list_cats',
    'single_post_title',
    'term_description',
    'term_name',
    'the_content',
    'the_excerpt',
    'the_title',
    'wp_title',
) as $filter ) {
    remove_filter($filter, 'wptexturize');
}

Let me know if you find any problems with this in your own themes.

Slaptijack's Koding Kraken