TinyMCE Editor Set Default Tab

I removed the tabs from the WP editor using

wp_editor('', 'some-id', array('quicktags' => false) );

But sometimes when the page loads the TinyMCE field loads with the Text tab selected:

gfb8r 1

Rather than the HTML tab:

xnoh0 1

Is there a way maybe with JS / JQuery to make sure the tab is always the visual
HTML tab?

Already tried:

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

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I came across this page — http://wp-snippets.com/set-default-editor/ * — which looks promising, though a little out of date. Instead of their code, I would suggest trying this:

add_filter( 'wp_default_editor', 'wpse101200_default_editor' );
function wpse101200_default_editor( $editor ) {
    return 'tinymce';
}

Reference

WPSeek’s wp_default_editor() page
wp_default_editor() in the WordPress core source

Unfortunately, the Codex doesn’t currently have a wp_default_editor() page.

__
* Apparently so did you. I missed that the first time I read your question.

Method 2

My solution.
I found that the problem was a JS WP setting.
A refresh of the page was required to make the editors initialise with the
new setting

<script>
if (getUserSetting('editor') != "tinymce") {
    setUserSetting('editor', 'tinymce');
    location.reload();
}
</script>


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x