Removing curly quotes from WordPress 2.0

WordPress beautifies single and double quotes, which can be a pain, when someone is posting a code sample. Going to functions-formatting.php inside wp-includes folder and commenting the lines below out removes all beautification for quotes:

$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);

Posted Saturday, February 18th, 2006 under WordPress.
  • http://www.slug.it/naufraghi/remove-curly-quotes-from-wordpress-20/ Naufraghi nella rete » Blog Archive » Remove curly quotes from WordPress 2.0

    [...] Thanks to http://www.moskalyuk.com for the idea and to the wordpress team for … wordpress! [...]

  • http://www.popjournalism.ca/ Robert

    Thanks! Before your fix, those bloody quotes have been causing problems in my feed for months. Cheers!

  • http://flashnbeyond.com/blog Christopher Tan

    Thanks. I’m trying to use WordPress to display ActionScript code.

  • http://www.newsmediarelease.com Dan

    Can’t thank you enough. Googled for a couple of hours trying to get around one apostrophe in one important post.

    This fix was the bomb :)

    Dan

  • http://singpolyma.net/ Stephen Paul Weber

    Any chance there’s a fix for this that is WP2.x compatible? A plugin would be nice, but I’d take anything… :)

  • http://mhinze.com/remove-curly-quotes-in-wordpress-21/ remove curly quotes in wordpress 2.1 » mhinze.com

    [...] there is a solution! (and it’s different than the 2.0 solution) [...]

  • http://www.moskalyuk.com/blog/removing-curly-quotes-from-wordpress-21/1403 Removing curly quotes from WordPress 2.1.* – alex.moskalyuk

    [...] while ago I wrote a post on preventing the curlification of the quotes on WordPress. This is useful when you run something like a code-sharing site, and each string variable gets [...]

  • http://www.andrewbibby.co.uk Andrew

    Nice work – been looking for a solution to this. :)