rest api - Got Blank issue for get data from wp-jsonv2post

admin2025-01-08  9

before I was enabled to get data from my website using Wordpress API V2. I access 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.

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.

Share Improve this question edited May 25, 2020 at 9:48 fuxia 107k38 gold badges255 silver badges459 bronze badges asked May 25, 2020 at 8:57 kevin tanzilkevin tanzil 1 2
  • So, if you write a post that has more than 2000 characters, the core posts endpoint returns nothing? – Tom J Nowell Commented May 25, 2020 at 9:39
  • Yes Mate, IDK why like that, the only way I get the data is to made customer API and did a print_r and I know that kind of things is not proper. have you know why it's happened? @TomJNowell – kevin tanzil Commented May 25, 2020 at 9:47
Add a comment  | 

1 Answer 1

Reset to default 0

the documentation that said there is the limit I got from this Post

WP REST API returns blank response if post is too long

and just I just solve it So How to fix this? I made a custom API, and convert my data to JSON using json_encode by using the option.

Solution $json = json_encode($your_array, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE)

return $json

by using that solution, you no need to echo the data.

Thanks for helping.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736268313a1265.html

最新回复(0)