Let’s say I have a WordPress blog that by default shows 10 posts per page but sometimes I’d like to show 50 posts per page. Is there a parameter in the URL that I can add to increase that limit to 50?
Update
This appears to work and is used in header.php:
// Support posts per page - Note: needs review
if (isset($_REQUEST['posts_per_page'])) {
$pageCount = $_REQUEST['posts_per_page'];
$wp_query->set("posts_per_page", $pageCount);
$wp_query->get_posts();
}
Yes, WP_Query has a parameter
posts_per_page
. You can change it by filteringpre_get_posts
or by using your own query.Here is an example from WordPress.Answers.