WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The script below is taken from a plugin that converts all textareas in the category and tags editors to rich text editors.

I'm using it to convert the category "Description" textarea input box to rich text. However, I have another text area on this same edit screen (one that I've added as a custom field) that I don't want rich text enabled. However, the plugin applies rich text to all edit fields.

Can someone tell from the code below how to do one of the following:

Disable rich text on a textarea with ID "myTextarea"?


Only apply the rich text to the Category "description" text area and no others? (preferred)

add_action('init', 'catde_init');
function catde_init() {
    if ( is_admin() || defined('DOING_AJAX') ) {
        if ( current_user_can('manage_categories') )
            remove_filter('pre_term_description', 'wp_filter_kses');

add_action('load-categories.php', 'catde_admin_init');
add_action('load-edit-tags.php', 'catde_admin_init');
function catde_admin_init() {
    if ( user_can_richedit() && isset($_GET['action']) && 'edit' === $_GET['action'] && ( !empty($_GET['cat_ID']) || ( !empty($_GET['taxonomy']) && !empty($_GET['tag_ID']) ) ) ) {
        add_filter( 'tiny_mce_before_init', 'catde_mceinit');
        add_action('admin_footer', 'wp_tiny_mce');
        add_action('admin_head', 'catde_head');

function catde_mceinit($init) {

    $init['mode'] = 'textareas';
    $init['editor_selector'] = '';
    $init['elements'] = 'category_description,description';
    $init['plugins'] = 'safari,inlinepopups,autosave,spellchecker,paste,wordpress,media,fullscreen';
    $init['theme_advanced_buttons1'] .= ',image';
    $init['theme_advanced_buttons2'] .= ',code';
    $init['onpageload'] = '';
    $init['save_callback'] = '';

    return $init;

function catde_head() { ?>
    <style type="text/css">#category_description_tbl,#description_tbl{border:1px solid #dfdfdf;}.wp_themeSkin .mceStatusbar{border-color:#dfdfdf;}</style>
share|improve this question
up vote 4 down vote accepted

Currently you're telling it to target all textareas on the page so you need to change

$init['mode'] = 'textareas'; to $init['mode'] = 'specific_textareas' or $init['mode'] = 'exact' and then name the textarea by id where you have $init['elements'] = 'category_description,description'; defined.

To read more about tinyMCE options go to http://tinymce.moxiecode.com/wiki.php/Configuration and the mode configuration description is here http://tinymce.moxiecode.com/wiki.php/Configuration:mode

share|improve this answer
+1 would go +5 if allowed :-) had to use "mode=exact" and elements = description. Worked a charm! – Scott B Feb 21 '11 at 19:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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