从/wp-json/v2/post获取数据时出现空白问题

时间:2020-05-25 作者:kevin tanzil

before I was enabled to get data from my website using Wordpress API V2. I access https://sitename.com/wp-json/wp/v2/posts it will return the post with default number per game is 10. then after we add more text on the post, it\'s seams return nothing, when I try to hit with the postman, it\'s blank, with body content-length is 0.

I have read so much article and documentation, some post said it because Wordpress did a substring while the return and it will return null if the char more than 2000 char.

Before I can get the data from the postman, there is anybody faces the same issue?

Thank you,Best Regards.

1 个回复
SO网友:kevin tanzil

文件上说这是我从这篇文章中得到的限制

WP REST API returns blank response if post is too long

我只是解决了这个问题怎么解决?我制作了一个自定义API,并使用该选项使用JSON\\u encode将数据转换为JSON。

解决方案$json=json\\U编码($your\\u array,json\\u HEX\\u TAG | json\\u HEX\\u APOS | json\\u HEX\\u Quote | json\\u HEX\\u AMP | json\\u UNESCAPED\\u UNICODE)

返回$json

通过使用该解决方案,您无需回显数据。

谢谢你的帮助。