Title: Default editor mode visual/text
Last modified: February 13, 2020

---

# Default editor mode visual/text

 *  Resolved [hommealone](https://wordpress.org/support/users/hommealone/)
 * (@hommealone)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/default-editor-mode-visual-text/)
 * I’d like my editor to always open in the text mode rather than the visual mode.
   Ideally, I’d like it to open in text mode for admins, and visual mode for editors.
 * I’ve tried adding some code to my functions.php file, with no success. I first
   tried this:
 *     ```
       if ( current_user_can('manage_options') ) {
       	add_filter('wp_default_editor', create_function('', 'return "html";'));
       } elseif ( current_user_can('edit_post') ) {
       	add_filter( 'wp_default_editor', create_function('', 'return "tinymce";'));
       }
       ```
   
 * When that didn’t work, and just for an experiment, I instead tried it without
   the conditional, for ‘always in text mode for everyone’ like this:
    `add_filter('
   wp_default_editor', create_function('', 'return "html";'));`
 * Neither worked. I’m wondering if there might be a conflict with my TinyMCE Advanced
   plugin that is preventing this from working?
 * Is there any kind of option for this within the TinyMCE Advanced plugin’s settings?
 * If this has nothing to do with the plugin, can you suggest troubleshooting steps
   to identify why my code is not working?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [hommealone](https://wordpress.org/support/users/hommealone/)
 * (@hommealone)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/default-editor-mode-visual-text/#post-12452157)
 * Solved: PEBKAC
 * BTW, I ended up using this code and it worked:
 *     ```
       /* Text editor for admins, visual editor for editors */
       function change_wp_default_editor() {
   
           if ( current_user_can('manage_options') ) {
               $r = 'html';
           } else {
       	$r = 'tinymce';
           }
   
           return $r;
       }
       add_filter( 'wp_default_editor', 'change_wp_default_editor' );
       ```
   
 * Alternately, your if statement could check for a specific user with get_current_user_id().
 *  Plugin Author [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/default-editor-mode-visual-text/#post-12494954)
 * This is part of WordPress (has nothing to do with the TinyMCE Advanced plugin).
   There are functions in both PHP and js to set these user options. See [https://developer.wordpress.org/reference/functions/set_user_setting/](https://developer.wordpress.org/reference/functions/set_user_setting/)
   and `window.setUserSetting()`.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Default editor mode visual/text’ is closed to new replies.

 * ![](https://ps.w.org/tinymce-advanced/assets/icon-256x256.png?rev=971511)
 * [Advanced Editor Tools](https://wordpress.org/plugins/tinymce-advanced/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tinymce-advanced/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tinymce-advanced/)
 * [Active Topics](https://wordpress.org/support/plugin/tinymce-advanced/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tinymce-advanced/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tinymce-advanced/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/default-editor-mode-visual-text/#post-12494954)
 * Status: resolved