Stop certain classes showing up in TinyMCE Advanced Style dropdown

This should be what you’re looking for – put this code into your theme’s functions.php file:

add_filter( 'tiny_mce_before_init', 'yourprefix_tiny_mce_before_init' );
function yourprefix_tiny_mce_before_init( $init_array ) {

    // filter styles:
    $init_array['theme_advanced_styles'] = "your_style=your_class";

    // filter formats:
    $init_array['theme_advanced_blockformats'] = "p,h3,h4,h5";

    return $init_array;
}

This way the only style that will be displayed is your_style.

The 3rd line is taking care of tinymce formats – might be useful too.

See Plugin_API/Filter_Reference/tiny_mce_before_init for more informations and examples.

Leave a Comment