EN / ZH
WordPress Tips: Disabling Character Conversion

The WordPress editor automatically converts certain input characters by default — for example, code gets escaped into encoded entities, and quotation marks undergo full-width/half-width conversion.

This feature is quite unfriendly for my use case. When I enter code in the editor, what gets displayed isn’t the original code, and readers who copy it are in for a bad time. If your blog, like mine, doesn’t really need this feature, you might as well disable WordPress’s full-width/half-width character conversion altogether.

Add the following code to your current theme’s functions.php file:

//Disable content conversion
remove_filter('the_content', 'wptexturize');
//Disable excerpt conversion
remove_filter('the_excerpt', 'wptexturize');
//Disable comment conversion
remove_filter('comment_text', 'wptexturize');

Done. If you, like me, prefer writing in a plain-text environment, you can also combine this with the method described in “Change the WordPress Editor Default View to HTML/Text” to make the WordPress editor default to the non-visual text editor with character conversion disabled.