[wp-trac] [WordPress Trac] #38378: Remove the `filter` parameter in the Post Controller
WordPress Trac
noreply at wordpress.org
Fri Oct 21 07:44:25 UTC 2016
#38378: Remove the `filter` parameter in the Post Controller
-------------------------------------+------------------------------
Reporter: websupporter | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch needs-refresh | Focuses:
-------------------------------------+------------------------------
Comment (by websupporter):
Our calculation of the max. pages needed `posts_per_page` to be set in our
`$query_args`. In order to overwrite `filter` we did so before. When I
deleted the `filter` stuff, I also deleted this, which produced a bug.
Since we always make sure, we add stuff only, when it is given in the
schema like
{{{#!php
<?php
if ( isset( $registered['per_page'] ) ) {
$args['posts_per_page'] = $request['per_page'];
}
}}}
I thought it might not be the best to rely on `posts_per_page` is set. In
[https://core.trac.wordpress.org/attachment/ticket/38378/38378.2.diff
38378.2.diff] I use the `$posts_query->query_vars` instead:
`$max_pages = ceil( $total_posts / (int)
$posts_query->query_vars['posts_per_page'] );`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38378#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list