首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过WP-API输出HTML元素

通过WP-API输出HTML元素
EN

WordPress Development用户
提问于 2014-11-07 11:57:29
回答 1查看 1.3K关注 0票数 0

我正在使用WP-API创建一个JavaScript应用程序,在这里我使用http请求将内容从WordPress数据库中提取出来。对于一个普通的帖子,我没有得到我所期望的所有元素数据。

我将以下文本放入可视化编辑器中。

侦探们正在调查一起可怕的谋杀一名妇女的指控,据称这名疑似杀手试图吃掉她。这位22岁的女子在南威尔士一家无家可归的旅社发生的令人震惊的事件中被咬伤,面部严重受伤。但招待所的一些邻居也声称,这名疑似袭击者在警察向他开枪后死亡,并对这名女子实施了食人行为。the警方拒绝就这些指控发表评论。然而,一位了解调查情况的消息人士表示,食人行为现在是一项调查。

我通过API请求发布,获取它们,但期望在每一段的开头和结尾使用p标记获得内容。相反,我得到了这个:

代码语言:javascript
复制
"content": "Detectives are investigating the horrific murder of a woman amid claims that the suspected killer was trying to eat her.\r\n\r\nThe 22-year-old woman is known to have been bitten and suffered terrible facial injuries in the shocking incident at a hostel for homeless people in south Wales.\r\n\r\nBut some neighbours of the hostel have also claimed the suspected attacker, who died after police fired a Taser at him, subjected the woman to an act of cannibalism.\r\n\r\nGwent police are refusing to comment on the claims. However, a source with knowledge of the investigation said that cannibalism was now a line of inquiry.",

WordPress编辑器或编码是我的问题吗?我更像一个JavaScript程序员,第一次使用WordPress,因为我想为客户端提供一个简单的接口。

EN

回答 1

WordPress Development用户

发布于 2014-11-07 13:23:08

我意识到了我的错误。下面是我的functions.php中的一行:

~remove_filter('the_content', 'wpautop');

这是在我启动项目时使用的WordPress下划线空模板中,并且正在从内容中删除html。

票数 1
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/167730

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档