0

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:

Rather than the HTML tab:

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";') );
  • In my experience, WordPress remembers which view you were using when you last saved a post/page/whatever. I have never looked into it deeper, to see if it's a cookie setting, or a user option, or what. – Pat J May 29 '13 at 20:58
  • Yep it does, which is annoying as I didnt want to have tabs on this box. – ptimson May 29 '13 at 21:03
0

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.

  • Thanks for your comment, yeah its strange that this doesnt work but I think it was being cached as a JS user setting. Ive posted my solution :) – ptimson May 30 '13 at 2:34
0

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.