Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to Rest API #20

Open
codebider opened this issue Aug 15, 2018 · 3 comments
Open

Add to Rest API #20

codebider opened this issue Aug 15, 2018 · 3 comments

Comments

@codebider
Copy link

codebider commented Aug 15, 2018

Can we add number of view to REST API
wp-json/wp/v2/posts

@bartoszarendt
Copy link
Contributor

It's available in the separate request, but I think we can also extend the default post object.

@codebider
Copy link
Author

codebider commented Aug 22, 2018

yep. currently, i added this command line
// Posts register_rest_field( 'post', 'number_of_views', array( 'get_callback' => array( $this, 'wp_api_number_of_views' ), 'schema' => null, ) );

@jmslasso
Copy link

jmslasso commented Sep 8, 2022

It's available in the separate request, but I think we can also extend the default post object.

How it is available in separate request? Can you provide an example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants