0

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.

2
  • So, if you write a post that has more than 2000 characters, the core posts endpoint returns nothing?
    – Tom J Nowell
    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 May 25, 2020 at 9:47

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.