WordPress.org

Forums

WP REST API (WP API)
[resolved] Retrieve Posts by Category ID or slug (2 posts)

  1. gianpaolo73
    Member
    Posted 1 year ago #

    Hello,
    Is there any REST API for retriveing all the published posts from a specific category by category slug or category ID?

    Can you post an example URI, please?
    And more in general: which is the query scheme for retrieving posts by categories, tags, or custom fields if there is one?

    Thank you very much in advance,
    Gianpaolo

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

  2. Ryan McCue
    Member
    Plugin Author

    Posted 1 year ago #

    Is there any REST API for retriveing all the published posts from a specific category by category slug or category ID?

    You can pass any parameters marked as public to WP_Query through via the filter parameter.

    In this case, you can do either /posts?filter[cat]=12 or /posts?filter[category_name]=my_cat_slug

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP REST API (WP API)
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic