Am I using the right hook for removing quicktags on the admin TinyMCE?

After checking out the code, the best way to do this would be to use the wp_editor_settings filter in /wp-includes/class-wp-editor.php. When you call wp_editor() it internally makes a call to _WP_Editors::editor($content, $editor_id, $settings);. This function first passes the $settings array through parse_settings() which uses that filter.

add_filter( 'wp_editor_settings', 'remove_editor_quicktags', 10, 2 );
function remove_editor_quicktags( $settings, $id ){
    // $id will be 'content' in your example
    // use it in an if or make it gone for everything...

    // use $pagenow to determine if you are on the edit comments page.
    global $pagenow; 
    if ( $pagenow === 'comment.php' ){
        $settings['quicktags'] = false;
    }
    return $settings;
}

Note – I just realized this filter is new as of WordPress 4.0, so you will need it or newer to take advantage. This also affects all instances of TinyMCE on the admin.

Leave a Comment