`max_num_pages` wrong when `-1 === posts_per_page`
-
Hello Mikko,
If I set
$query->set( 'posts_per_page', -1 );
in'pre_get_posts'
,max_num_pages
will be the number of results. It should be equal to 1.
Since Genesis’ pagination uses this value, it will display pagination when there should be none.I think the mistake is in
relevanssi/lib/search.php:906
:if ( -1 === $query->query_vars['posts_per_page'] ) { $query->max_num_pages = $hits_count; }
$hits_count
should be replaced with1
(or the case could be dropped completely).Is there a reason that I didn’t see, why it is set this way?
Thank you,
JosefPS: In the meantime it is avoided by using
$query->set( 'nopaging', true );
, sinceposts_per_page
is not set this way.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.