Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
插入带有HTML标记的帖子-Wordpress API&;PHP_Html_Wordpress_Api_Post_Insert - Fatal编程技术网

插入带有HTML标记的帖子-Wordpress API&;PHP

插入带有HTML标记的帖子-Wordpress API&;PHP,html,wordpress,api,post,insert,Html,Wordpress,Api,Post,Insert,我在使用wpapi插入带有HTML标记的帖子时遇到了问题 我使用的方法是:wp\u insert\u 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. 和可视化编辑器: Hi, th

我在使用wpapi插入带有HTML标记的帖子时遇到了问题

我使用的方法是:wp\u insert\u 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.
和可视化编辑器:

Hi, this is an example <br/> of the content.
Hi, this is an example
of the content.
所有html标记都会出现这种情况

多谢各位

****用代码更新****

$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 );
$content=“您好,这是内容的一个示例。”;
$my_post=数组(
“post_title”=>$title,
“发布状态”=>“发布”,
“发布内容”=>$content,
“后作者”=>1,
‘post_category’=>数组(8,39));
//将帖子插入数据库
$post\u id=wp\u insert\u post($my\u post);
我找到了一个解决方案:

html_实体_解码($content)


请粘贴一些代码参考。插入邮政编码。
$content=“您好,这是内容的一个示例。”$我的帖子=数组('post\u title'=>$title',post\u status'=>publish','post\u content'=>$content'post\u author'=>1',post\u category'=>array(8,39)//meter las categorias);//将帖子插入数据库$post\u id=wp\u Insert\u post($my\u post)Hi, this is an example
of the content.
$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 );