2016-08-26 9 views
0

WP APIに問題があり、HTMLタグ付き投稿を挿入しました。HTMLタグ付きの投稿を挿入する - Wordpress APIとPHP

私はメソッドを使用しています:wp_insert_post()とコンテンツがこのようなものです:私は投稿を公開するとき、私はしたい

$content = "Hi, this is an example <br/> of the content."; 

結果は次のとおりです。

Hi, this is an example 
of the content 

しかし、私が投稿を発表したときの結果:

Hi, this is an example <br/> of the content. 

私がWPエディタO、テキストエディタは次のようになります。

Hi, this is an example &lt;br/&gt; of the content. 

とビジュアルエディタ:

Hi, this is an example <br/> of the content. 

Hi, this is an example <br/> of the content. 

そしてobviosly 私は、テキストエディタでこの結果をしたいですビジュアルエディタで:

Hi, this is an example 
of the content. 

これはすべてのhtmlタグで発生します。

ありがとうございました。

****私は解決策見つけたCODE ****

$content="Hi, this is an example <br/> of the content."; 
$my_post = array( 
'post_title' => $title, 
'post_status' => 'publish', 
'post_content' => $content, 
'post_author' => 1, 
'post_category' => array(8,39)); 
// Insert the post into the database 
$post_id = wp_insert_post($my_post); 
+0

をいくつか貼り付けてくださいあなたのコードの参照。挿入郵便番号。 – DpEN

+0

'$ content ="こんにちは、これは内容の
の例です。 $ my_post =配列( \t \t \t 'POST_TITLE' => $タイトル、\t \t \t \t \t 'post_status' => '公開'、 \t \t \t 'POST_CONTENT' => $コンテンツ \t \t \t 'post_author' => 1、 \t \t \t array_(8,39)// array las categorias \t \t \t); \t \t \t //データベース \t \t \t $ post_idの= wp_insert_post($ my_post)にポストを挿入します; ' – LuisFernandez

答えて