[wp-trac] [WordPress Trac] #22299: posts_per_page value in $wp_query does not work in index.php
WordPress Trac
noreply at wordpress.org
Sun Oct 28 02:22:33 UTC 2012
#22299: posts_per_page value in $wp_query does not work in index.php
--------------------------+------------------------------
Reporter: alexvorn2 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Resolution:
Keywords: close |
--------------------------+------------------------------
Comment (by alexvorn2):
Replying to [comment:1 SergeyBiryukov]:
> `pre_get_posts` hook should be used instead.
>
> See #11067, #16168, #16450, #19463.
we can use like this
{{{
function hwl_home_pagesize( $query ) {
$query->query_vars['posts_per_page'] = 1;
return;
} add_action('pre_get_posts', 'hwl_home_pagesize', 1);
}}}
But this will be like a global function that will apply the same settings
to all loops, not good. Why not just update "posts_per_page" option with
"1"?
This is a bug 100%
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22299#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list