WordPress REST API:json post_content中的线路休息
我正在WordPress API中创建一些自定义路由。一切都很好,但是我在检索帖子的post_content时遇到了问题。 JSON中的格式无效。休息。
我想保留标签。
'descripcion' => get_post_field('post_content', $post->ID)
谢谢
I am creating some custom routes in the wordpress API. Everything works fine, but I'm having a problem retrieving the post_content of a post. The format in json is not valid. Make a line break.
If you remove all html tags with wp_strip_all_tags it works fine, but it is not the case to use it. I want to keep the labels.
'descripcion' => get_post_field('post_content', $post->ID)
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过这样的尝试?
或者,
请阅读此2个功能的PHP文档。
Have you ever tried like this?
or
Please read the PHP documentation of this 2 functions.