I’ve used this script below inside functions.php since WP 3.5

It converts the standard category description editor to a rich text editor. Unfortunately, after upgrading sites to WP 3.9, the description editor is back to a standard text area.

Any ideas what I need to change for 3.9?

add_action('load-categories.php', 'cb_admin_init');
add_action('load-edit-tags.php', 'cb_admin_init');

function cb_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', 'cb_mceinit');
        add_action('admin_footer', 'wp_tiny_mce');
        add_action('admin_head', 'cb_head');
    }
}

function cb_mceinit($init)
{
    $init['mode'] = 'exact';
    $init['editor_selector'] = 'description';
    $init['elements'] = 'category_description,description';
    $init['plugins'] = 'safari,inlinepopups,spellchecker,paste,fullscreen';
    $init['theme_advanced_buttons1'] .= ',image';
    $init['theme_advanced_buttons2'] .= ',code';
    $init['onpageload'] = '';
    $init['save_callback'] = '';
    return $init;
}

function cb_head()
{
wp_enqueue_style('editor-buttons');
    ?>
<style type="text/css">#category_description_tbl,#description_tbl{border:1px solid #dfdfdf;}.wp_themeSkin .mceStatusbar{border-color:#dddddd;}</style><?php
}


add_action('init', 'cb_editor_init');

2 s
2

I was having the same issue and the problem was actually coming from the way the js was dynamically generating tinyMCE.

Prior to v.4, it was:

tinymce.EditorManager.execCommand('mceAddControl', true, id);

With 4, you need to use:

tinymce.EditorManager.execCommand('mceAddEditor', true, id);

Have a look at wherever your function ‘wp_tiny_mce’ is – might be in there.

Leave a Reply

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