[wp-trac] [WordPress Trac] #17853: Posts_per_page=-1 overwritten in query.php if is feed, (An ics feed needs all)
WordPress Trac
wp-trac at lists.automattic.com
Mon Jun 20 03:58:29 UTC 2011
#17853: Posts_per_page=-1 overwritten in query.php if is feed, (An ics feed needs
all)
--------------------------+-----------------------------
Reporter: anmari | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Feeds | Version: 3.2
Severity: normal | Keywords:
--------------------------+-----------------------------
Similar to [http://core.trac.wordpress.org/changeset/15852 15852], the
posts_per_page argument to wp_query, is being overwritten in lines 1991 of
query.php
{{{
if ( $this->is_feed ) {
$q['posts_per_page'] = get_option('posts_per_rss');
}}}
In the case of an ics feed - ALL requested posts must be returned for a
complete feed, so need to be able to pass posts_per_page=-1 as with other
queries in the front end.
This is in wp 3.2 RC1 and earlier.
As far as I can make out, the only way around for now is to add a
post_limits filter and remove the LIMIT in the query when it is a ics
feed. (ie return empty string)
While the workaround works, it would make more sense of the post_per_page
argument worked as in front end queries.
Possible workaround (use in custom feed function only)
{{{
...
add_filter('post_limits', 'amr_remove_limits');
...
function amr_remove_limits () {
return ('');
// return an empty string so that NO limits are imposed in the query
}
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17853>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list