Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Limit results pages › Reply To: Limit results pages
December 22, 2016 at 1:36 pm
#11348
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;
}