我把這段代碼放在我的wordpress function.php中。WordPress中的Tinymce錯誤頁面類別
remove_filter('pre_term_description', 'wp_filter_kses');
remove_filter('term_description', 'wp_kses_data');
add_filter('edit_category_form_fields', 'cat_description');
function cat_description($tag)
{
?>
<table class="form-table">
<tr class="form-field">
<th scope="row" valign="top"><label for="description"><?php _ex('Description', 'Taxonomy Description'); ?></label></th>
<td>
<?php
$settings = array('wpautop' => true, 'media_buttons' => true, 'quicktags' => true, 'textarea_rows' => '15', 'textarea_name' => 'description');
wp_editor(wp_kses_post($tag->description , ENT_QUOTES, 'UTF-8'), 'cat_description', $settings);
?>
<br />
<span class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></span>
</td>
</tr>
</table>
<?php
}
add_action('admin_head', 'remove_default_category_description');
function remove_default_category_description()
{
global $current_screen;
if ($current_screen->id == 'edit-category')
{
?>
<script type="text/javascript">
jQuery(function($) {
$('textarea#description').closest('tr.form-field').remove();
});
</script>
<?php
}
}
Tinymce你看得很對。
但是應該在「content-html」中顯示的文本顯示在「content-tmce」中。
例如:
"content-html": <strong>hello</strong>
"content-tmce": <strong>hello</strong>
我必須按照本指南:https://paulund.co.uk/add-tinymce-editor-category-description
我該如何解決?
你在哪裏得到這個代碼?它是一個指南嗎?你能鏈接到任何其他資源或例子嗎? –
我遵循這一點:https://paulund.co.uk/add-tinymce-editor-category-description –
你能解釋一下這裏有什麼困擾你嗎?對我來說,它似乎工作正常。我的意思是,它應該很好...... –