Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

Query params for collections #924

Closed
Closed

Description

@danielbachhuber

If you have a bug to report relating to querying for posts, terms, users, comments, etc., please open a new issue — this issue is intended to be a master reference.

This issue is a master issue representing work on query parameters in collections. Here's a table of the currently supported parameters:

+----------------+-------+-------+-------+----------+------------+-------+-------+
| param          | posts | pages | media | comments | categories | tags  | users |
+----------------+-------+-------+-------+----------+------------+-------+-------+
| after          |   x   |   x   |   x   |   x      |            |       |       |
| author         |   x   |   x   |   x   |   x      |            |       |       |
| author_email   |       |       |       |   x      |            |       |       |
| author_exclude |   x   |   x   |   x   |   x      |            |       |       |
| before         |   x   |   x   |   x   |   x      |            |       |       |
| context        |   x   |   x   |   x   |   x      |   x        |   x   |   x   |
| exclude        |   x   |   x   |   x   |   x      |   x        |   x   |   x   |
| filter         |   x   |   x   |   x   |          |            |       |       |
| hide_empty     |       |       |       |          |   x        |   x   |       |
| include        |   x   |   x   |   x   |   x      |   x        |   x   |   x   |
| karma          |       |       |       |   x      |            |       |       |
| media_type     |       |       |   x   |          |            |       |       |
| menu_order     |       |   x   |       |          |            |       |       |
| mime_type      |       |       |   x   |          |            |       |       |
| offset         |   x   |   x   |   x   |   x      |            |   x   |   x   |
| order          |   x   |   x   |   x   |   x      |   x        |   x   |   x   |
| orderby        |   x   |   x   |   x   |   x      |   x        |   x   |   x   |
| page           |   x   |   x   |   x   |   x      |   x        |   x   |   x   |
| parent         |       |   x   |   x   |   x      |   x        |       |       |
| parent_exclude |       |   x   |   x   |   x      |            |       |       |
| per_page       |   x   |   x   |   x   |   x      |   x        |   x   |   x   |
| post           |       |       |       |   x      |   x        |   x   |       |
| search         |   x   |   x   |   x   |   x      |   x        |   x   |   x   |
| slug           |   x   |   x   |   x   |          |   x        |   x   |   x   |
| status         |   x   |   x   |   x   |   x      |            |       |       |
| type           |       |       |       |   x      |            |       |       |
+----------------+-------+-------+-------+----------+------------+-------+-------+

Related #605

Activity

  1. added this to the 2.0 milestone on Feb 25, 2015
  2. rachelbaker commented on Apr 15, 2015

    @rachelbaker
    Member

    Punting to Beta 2.

  3. rachelbaker commented on Jun 15, 2015

    @rachelbaker
    Member

    Punted to Beta 4

  4. modified the milestones: 2.0, 2.0 Beta 4 on Aug 7, 2015
  5. 5 remaining items

  6. removed their assignment
    on Feb 5, 2016
  7. davidsteinberger commented on Mar 1, 2016

    @davidsteinberger

    What was the specific reason to remove menu_order from the posts-endpoint?

  8. danielbachhuber commented on Mar 2, 2016

    @danielbachhuber
    MemberAuthor

    What was the specific reason to remove menu_order from the posts-endpoint?

    Posts don't support menu_order, Pages do.

  9. davidsteinberger commented on Mar 2, 2016

    @davidsteinberger

    Well yes, but there are tons of plugins that do provide a menu_order. In the previous beta menu_order was still allowed, but now it's blocked. Do you know what's the proper way for me to re-enable that again (just for myself)?

  10. joneslloyd commented on Mar 3, 2016

    @joneslloyd

    Hey - just asking to confirm:

    Right now will filtering a CPT to those with a specific parent ID not work?

    For example: http://example.com/wp-json/wp/v2/my-cpts?filter[parent]=304 ?

    If not, do you know if this is something in progress? I can help achieve this if you need an extra hand

  11. danielbachhuber commented on Mar 4, 2016

    @danielbachhuber
    MemberAuthor

    Do you know what's the proper way for me to re-enable that again (just for myself)?

    You should be able to use /wp/v2/posts?filter[menu_order]

    Right now will filtering a CPT to those with a specific parent ID not work?

    It should work — the filter key is post_parent though: /wp/v2/my-cpts?filter[post_parent]=304

  12. joneslloyd commented on Mar 4, 2016

    @joneslloyd

    @danielbachhuber Thanks fore getting back to me!

    Unfortunately that doesn't seem to be working for CPTs. I've not modified the returned data (etc.) which is weird.

    When I try what you've written, I just get [] returned

  13. joneslloyd commented on Mar 14, 2016

    @joneslloyd

    Just to let you know, this is definitely an issue.

    When trying to filter by ID (/wp/v2/my-cpts?filter[id]=333) it returns the full set (all posts of the CPT, unfiltered).

    When trying to filter by post parent (as above in previous reply) it returns a blank array.

  14. BE-Webdesign commented on Mar 14, 2016

    @BE-Webdesign
    Member

    @joneslloyd id isn't a WP_Query param nor do I believe there is an id param being added to filter as a mask for the WP_Query params. So I am pretty sure filter[id] doesn't work causing everything to be returned. To do what you are trying to do I highly recommend this. /wp/v2/my-cpts/333 or if you want filter it could be /wp/v2/my-cpts?filter[p]=333.

    When trying to filter by post parent (as above in previous reply) it returns a blank array.

    I can check about the use of post_parent and see if I can duplicate an empty result set. @joneslloyd please open this in a separate issue if you want it addressed though this is a master reference and not intended for these kind of discussions.

  15. rmccue commented on Sep 22, 2016

    @rmccue
    Member

    We're closing this ticket out in favour of more concrete tickets instead. If you have anything you need with params, please file a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions