Reply To: Limit results pages

#11348

rafaschutz
Participant

Hi, thank for the reply.

But i've already tried this, and changing the results posts_per_page didnt affected the query.

I've solved the problem by overriding the GLOBAL posts_per_page for each page on the filter pre_option_posts_per_page:

/////////////////////////////////////////////
add_filter('pre_option_posts_per_page', 'override_limits');

function override_limits() {
if(isset($_GET[“t”])) {
$searchtype = $_GET[“t”];
}
else {
$_GET[“t”];
}

if($searchtype==”map”||$searchtype==”print”) {
$limit = -1;
}
else {
$limit = 50;
}

return $limit;
}