直到今天的更新,下面的代码在将富格文本编辑器控件添加到类别描述编辑器中时工作得非常完美。今天,它在更新到3.3后停止工作
有什么线索可以调整吗?
<?php
function my_editor_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\', \'my_admin_init\');
add_action(\'load-edit-tags.php\', \'my_admin_init\');
function my_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\', \'my_mceinit\');
add_action(\'admin_footer\', \'wp_tiny_mce\');
add_action(\'admin_head\', \'my_head\');
}
}
function my_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 my_head()
{ ?>
<style type="text/css">#category_description_tbl,#description_tbl{border:1px solid #dfdfdf;}.wp_themeSkin .mceStatusbar{border-color:#dddddd;}</style><?php
}
add_action(\'init\', \'my_editor_init\');
?>
最合适的回答,由SO网友:Scott B 整理而成
这在3.3中发生了变化
在my\\u head()函数下面添加此行。。。。
wp_enqueue_style(\'editor-buttons\');