2017-08-22 18 views
1

私はWPへのプラグインを作成していますが、wp_insert_termを使用してタグジェネレータを作成しましたが、説明フィールドのユーザーのhtml形式は無視されます。たとえば、{<h1> Example </h1>}は、新しいタグの説明に「例」(見出しなし)のみを示します。説明のためのテキストは、私のプラグインサイトにあるhtml textareaフィールドによって追加されています。任意のアイデアHTMLフォームとタグの説明を追加する方法?WordPress wp_insert_term:HTML形式のタグ記述

答えて

2

デフォルトでは、WordPressはカテゴリの説明からHTMLを取り除きます。あなたのテーマのfunctions.phpファイルに小さなスニペットを追加することで回避できます。

//prevents html from being stripped from term descriptions 
foreach (array('pre_term_description') as $filter) { 
    remove_filter($filter, 'wp_filter_kses'); 
} 

//prevents html being stripped out when using the term description function (http://codex.wordpress.org/Function_Reference/term_description). 
foreach (array('term_description') as $filter) { 
    remove_filter($filter, 'wp_kses_data'); 
} 
関連する問題