0

This is my first time working with Wordpress APIs, and i'm not a PHP developer. Essentially our client just wanted us to display WordPress articles in our react-native app with simple data like the:

  • date
  • title
  • content
  • thumbnail
  • etc..

...anything you'd find in the default response, and this was easy. We simply used the default endpoints like this one: https://demo.com/wp-json/wp/v2/posts?categories=1015

Anyways... Our client now wants to display the "view count" of each article. However, i can't find that data in the default response:

enter image description here

Is there a way to get this view count data, and have it return in the API response, without having to customize every single endpoint?

Thanks

1
  • That's because WordPress does not record views. You'll have to use a plugin for that.
    – cjbj
    Jun 6, 2020 at 10:23

1 Answer 1

0

You have to write the post view count logic. After that you have to call that meta count in in rest API using the below API code. This link will help to get count response in the rest api.

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.