`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_pageswill 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_countshould 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_pageis not set this way.
The topic ‘`max_num_pages` wrong when `-1 === posts_per_page`’ is closed to new replies.