• Samuele Colombo

    (@samuele-colombo)


    Hi,
    I try to retrieve a custom data from all posts of a particular type AND (this is the most important stuff) to return formatted code.

    Example: I have 10 posts of type “book”, each book has a meta_key “feedback” and a field “author”. I need to retrieve the AVERAGE of feedbacks of an author.

    So, my URL could be http://example.com/wp-json/posts?post_type=book&author=1

    I’ve three questions:

    • How can I retrieve data from custom fields?
    • Exists a way to make the average of the feedbacks directly in my PHP code?
    • If I would hide the number of the author (this is the same in WP database…not very strong in terms of security) and use another key? can I take custom meta_key from user?

    https://wordpress.org/plugins/json-rest-api/

  • The topic ‘Operations before send using custom fields’ is closed to new replies.