I have a tab switching theme that lets the user choose 3 editing modes when adding new pages (HTML and Visual- these are WP defaults and the new Syntax mode using Code Mirror).

I have issues when switching from Syntax back to HTML and Visual. It seems that the tab switching is unstable and the editor is not restored back to its normal WP default behaviour.

I plan to use the default switchEditors.switchto function by WP but I don't know what parameters I would like to feed to it. Can someone please show me an example how to use this function in a custom JS function (like inside a theme?) Thanks.

1 Answer 1


switchEditors is written only to handle request between html, tmce, tinymce options. It's no luck to extend it functionality. Better use of jQuery events like $(el).on('click, ... )

// WP 3.8 build

You can extend standard Wordpress function in order to make some custom functionality like this:

(function ( $ ) {
    "use strict";

    $(function () {

        window.switchEditors.go = function( id, mode ) {

            return false;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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