Title: Get Posts from REST API with query parameter
Last modified: August 1, 2023

---

# Get Posts from REST API with query parameter

 *  Resolved [Saksham](https://wordpress.org/support/users/sakshamt/)
 * (@sakshamt)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/get-posts-from-rest-api-with-query-parameter/)
 * How can I use query parameters to filter data that I get from REST API?
 * I have this data in the REST API response that I get. I want to get all posts
   where cp_status is 0 and cp_type is online.
 * **{**“id”: **27422**,”menu_order”: **1617**,”cp_status”: “0”,”cp_type”: **[**“
   online”**]}**,**{**“id”: **24472**,”menu_order”: **1636**,”cp_status”: “1”,”cp_type”:**[**“
   online”**]}**

Viewing 1 replies (of 1 total)

 *  Plugin Support [pdclark](https://wordpress.org/support/users/pdclark/)
 * (@pdclark)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/get-posts-from-rest-api-with-query-parameter/#post-16939296)
 * Filtering of WordPress core REST responses was removed in WordPress 4.7. The 
   feature can be added back with [this unmaintained plugin](https://github.com/WP-API/rest-filter),
   which follows [this format for meta queries](https://github.com/WP-API/rest-filter/pull/22)
   and may require [filtering query_vars](https://github.com/WP-API/rest-filter/issues/3#issuecomment-268342560).
 * See [https://developer.wordpress.org/rest-api/frequently-asked-questions/#what-happened-to-the-filter-query-parameter](https://developer.wordpress.org/rest-api/frequently-asked-questions/#what-happened-to-the-filter-query-parameter).
 * Alternatively, you can filter the queries for the REST responses using the [pre_get_posts](https://developer.wordpress.org/reference/hooks/pre_get_posts/)
   action, which passes the [WP_Query](https://developer.wordpress.org/reference/classes/wp_query/)`
   $query` object by reference (see [this article](https://wpshout.com/practical-uses-pre_get_posts/#gref);
   check the `REST_REQUEST` constant, or hook to `rest_api_init`), or by [writing a custom endpoint](https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/).
 * This is really only tangentially related to Pods in that Pods provides a checkbox
   which passes `true` or `false` to the `show_in_rest` parameter of [register_post_type()](https://developer.wordpress.org/reference/functions/register_post_type/).

Viewing 1 replies (of 1 total)

The topic ‘Get Posts from REST API with query parameter’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [pdclark](https://wordpress.org/support/users/pdclark/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/get-posts-from-rest-api-with-query-parameter/#post-16939296)
 * Status: resolved