是否有方法将TinyMCE编辑器添加到术语编辑页面上的分类描述字段?这里的解决方案(Can you add the visual editor to the description field for custom taxonomies?) 我认为这不再有效,因为wp\\u tiny\\u mce函数已被弃用。
用可视化/所见即所得编辑器替换Taxomony Description字段
2 个回复
最合适的回答,由SO网友:Oleg Butuzov 整理而成
您可以使用{$taxonomy}_edit_form_fields 将html添加到术语编辑表的操作挂钩。在该HTML中,您可以删除描述文本区域并添加tinymce编辑器
add_action("{$taxonomy}_edit_form_fields", \'add_form_fields_example\', 10, 2);
function add_form_fields_example($term, $taxonomy){
?>
<tr valign="top">
<th scope="row">Description</th>
<td>
<?php wp_editor(html_entity_decode($term->description), \'description\', array(\'media_buttons\' => false)); ?>
<script>
jQuery(window).ready(function(){
jQuery(\'label[for=description]\').parent().parent().remove();
});
</script>
</td>
</tr>
<?php
}
SO网友:jg314
对于那些仍在寻找此问题解决方案的人来说,值得一提的是Yoast SEO plugin 在分类术语编辑屏幕上自动为描述添加所见即所得编辑器。
如果您不打算将该插件用于SEO,请不要仅为该功能添加该插件。考虑到该插件的受欢迎程度,我认为值得注意,因为它可以为已经计划安装该插件的人节省时间。
结束