If you need to make sure that your custom post type doesn’t have the ‘visual’ tab, you can easily diable it. Suppose you have a custom post type named ‘movie’:
add_filter( 'user_can_richedit', 'disable_for_cpt' );
function disable_for_cpt( $default ) {
global $post;
if ( 'movie' == get_post_type( $post ) )
return false;
return $default;
}
Currently, any buttons added to the 3rd or 4th rows will always be visible (Kitchen Sink only shows/hides the 2nd row) – but a patch has been submitted to correct this, hopefully it’ll be committed.
However, if you’ll probably want to clean up the font options – remove fonts that you’ll never use (or should never be used).
Normally, WordPress will remember which editor mode you were in (Visual or HTML). So if you were using the HTML editor and you save a page, you’ll be returned to the HTML editor.
If you (or your clients) would benefit from always returning to particular mode, you can set that up
add_filter( 'wp_default_editor', 'force_default_editor' );
function force_default_editor() {
//allowed: tinymce, html, test
return 'tinymce';
}
If you find yourself needing to add non-standard tags to the WordPress editor, you may also find yourself feeling very frustrated. With just a little bit of code, you can tell the editor to accept extra tags
add_filter( 'tiny_mce_before_init', 'mce_extended_valid_elements', 10, 2);
function mce_extended_valid_elements( $mceInit, $editor_id ) {
//allow only the basic tag
//$mceInit['extended_valid_elements'] .= ',sometag';
//allow the tag and a attribute
$mceInit['extended_valid_elements'] .= ',sometag[someattribute]';
//allow the tag and multiple attribute
//$mceInit['extended_valid_elements'] .= ',sometag[someattribute|anotherattribute]';
//allow the tag and any attribute
//$mceInit['extended_valid_elements'] .= ',sometag[*]';
return $mceInit;
}