Changing the WordPress Editor
The WordPress Editor is where you add your content to posts and pages. When adding your content, you have two different options: Visual and Text. The Visual Editor is where you can edit text and your page’s layout “visually”, no HTML required. It also contains the kitchen sink bar that has many of the shortcuts for inserting shortcodes from themes and plugins like WooCommerce. For this reason, the Visual Editor can be very useful. The Text/HTML Editor, however, is used with HTML/CSS and is, therefore, the more flexible option.
Why would you want to set a default? Something happens when switching between the two editors. When you write a post and include HTML markup, such as <p> tags, you probably want that markup to remain in tact. If you switch over to the Visual editor for any reason, some of your markup may be lost when you return to the Text editor (the <p> are one example). Sometimes this can occur accidentally when you use the Visual editor somewhere else on your website and then revisit the edit page of a post with markup. Since your last editor was the Visual, WordPress will automatically display your post in the Visual editor. This causes some of your HTML tags to be erased. Needless to say, this can be a major annoyance. The good news is that there’s a way to fix this. Just place one of these bits of of code into your functions.php!
//Set Visual Editor as default add_filter( 'wp_default_editor', create_function('', 'return "tinymce";') ); //Set HTML Editor as default add_filter( 'wp_default_editor', create_function('', 'return "html";') );
Remember to not paste both into your functions.php.
Leave a Reply