Open posts in editor in the ‘Text’ mode by default

I have a few posts where there are some code segments. When I try to make small edits in the post, it opens in the ‘Visual’ mode and all the non-alphanumeric characters (e.g. >) are converted to their html equivalents (e.g. >). Also I lose all the indentation. I would like to open all posts in the ‘Text’ mode by default. Is it possible to do that?

1 Answer
1

Add the following line to your theme’s functions.php:

add_filter( 'wp_default_editor', create_function( '', 'return "html";' ) );

Use “html” to set the Text editor tab as default (as shown above), or “tinymce” to set the Visual editor tab as default.

Leave a Comment