Disable WordPress Formatted Entities

Recently while I was working on my Linux blog, I noticed that WordPress started formatting “–” as “—”, which was quite frustrating as commands become useless without proper attributes/switches.

The following is the table with list of text which Replaces common plain text characters with formatted entities.
Information taken from wptexturize()

source texttransformed textsymbol name
“—”“—”em-dash
" – "“—”em-dash
“–”“–”en-dash
" - "“–”en-dash
“…”“…”ellipsis
``opening quote
“hello“helloopening quote
‘hello‘helloopening quote
'’closing quote
world.”world.”closing quote
world.'world.’closing quote
" (tm)"" ™"trademark symbol
1234"1234″double prime symbol
1234'1234′prime symbol
‘99’99apostrophe before abbreviated year
Webster’sWebster’sapostrophe in a word
1234x12341234×1234multiplication symbol

To disable the wptexturize() function, one can add following to the function.php of currently activated theme or by creating a plugin

add_filter('run_wptexturize', '__return_false');

I’ve chosen to create a plugin and add the above code, as with changing theme, I don’t need to worry about the problem arising again.

Built with Hugo
Theme Stack designed by Jimmy