Smart quotes in WP

March 7th, 2005. Tagged: WordPress

I didn't like the way WP is adding smart qoutes to my posts. This is especially annoying when you post programming code. So it had to go :-\
I couldn't find an option to disable smart-quoting in the WordPress back-end so I took a look at the code and commented a few lines.

The commented lines were in
/wp-include/functions-formatting.php
in the wptexturize() function
right after the cockney conversions.

/*
$curl = preg_replace("/'s/", '’s', $curl);
$curl = preg_replace("/'(\d\d(?:’|')?s)/", "’$1", $curl);
$curl = preg_replace('/(\s|\A|")\'/', '$1‘', $curl);
$curl = preg_replace('/(\d+)"/', '$1″', $curl);
$curl = preg_replace("/(\d+)'/", '$1′', $curl);
$curl = preg_replace("/(\S)'([^'\s])/", "$1’$2", $curl);
$curl = preg_replace('/(\s|\A)"(?!\s)/', '$1“$2', $curl);
$curl = preg_replace('/"(\s|\S|\Z)/', '”$1', $curl);
$curl = preg_replace("/'([\s.]|\Z)/", '’$1', $curl);
$curl = preg_replace("/ \(tm\)/i", ' ™', $curl);
$curl = str_replace("''", '”', $curl);
*/

In this code snippet, the conversion of (tm) into ™ was also disabled, this is the line before the last one. Feel free to keep it your code, it was just easier to comment out the whole block.

Tell your friends about this post on Facebook and Twitter

Sorry, comments disabled and hidden due to excessive spam.

Meanwhile, hit me up on twitter @stoyanstefanov