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

Conversation

@joehoyle
Copy link
Member

Currently, /wp/v2/posts allows WP_Query params and a few of our own
"per_page" etc. This is confusing and inconsistant. I think we discussed a
while back that we'd put all the WP_Query (internal) named collection params
under a filter param (inspired by v1) and implement standardized collection
params for posts that's inline with the params for terms, users and
comments.

Feedback on this before I go further I think :)

Currently, `/wp/v2/posts` allows WP_Query params and a few of our own
"per_page" etc. This is confusing and inconsistant. I think we discussed
a while back that we'd put all the WP_Query (internal) named collection
params under a `filter` param (inspired by v1) and implement
standardized collection params for posts that's inline with the params
for `terms`, `users` and `comments`.
@joehoyle joehoyle self-assigned this Jul 24, 2015
@joehoyle joehoyle added this to the 2.0 Beta 4 milestone Jul 24, 2015
@rmccue
Copy link
Member

rmccue commented Jul 24, 2015

👍 on the concept. Right now, having the raw WP_Query vars is a bit confusing.

@danielbachhuber
Copy link
Member

I think I started but never completed this in #1302. It might be worthwhile to just finish that branch

@rachelbaker
Copy link
Member

Why only do this for /posts/? Shouldn't we do this for /users/, /comments/, and '/taxonomies/' as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always thought paged and posts_per_page being outside of the filter argument was weird. If we are going to move the WP_Query args to the filter array we should move them all!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rachelbaker I did move them all :) this is mapping page and per_page to WP_Query vars.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filter is only for WP_Query arguments. page and per_page are our new, consistent with the rest of the controllers, arguments.

@rmccue
Copy link
Member

rmccue commented Jul 24, 2015

Why only do this for /posts/?

As @joehoyle noted, "Feedback on this before I go further I think :)", so probably just proving it out with posts first.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joehoyle we should probably unset post_type here

@rmccue
Copy link
Member

rmccue commented Aug 7, 2015

Why only do this for /posts/?

One problem with not doing it for the others is that we don't know which variables can be public, since there's no analog to WP::$public_query_vars that I can see for the others.

I'm going to merge this for now, since the others already use our custom mapping. If we want to add the ability to get at the underlying WP_*_Query args, we can handle that later for each. This PR simply brings /posts in line with our custom query args, while maintaining filter for full access.

@joehoyle
Copy link
Member Author

joehoyle commented Aug 7, 2015

Looks good to me

rmccue added a commit that referenced this pull request Aug 7, 2015
Move /posts WP_Query vars to `filter` param
@rmccue rmccue merged commit 2d17ba4 into develop Aug 7, 2015
@rmccue rmccue deleted the posts-colletion-args branch August 7, 2015 18:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants