Forcing a Visual or HTML Mode in WP_Editor

If you are incorporating the built-in TinyMCE editor into a WordPress Plugin using wp_editor() it is possible to force it into a mode. Simply latch onto the wp_default_editor hook:

add_filter( 'wp_default_editor', 'force_default_editor' );

function force_default_editor() {
    //allowed: tinymce, html, test
    return 'tinymce';
}

Leave a Reply

Your email address will not be published. Required fields are marked *