Pagination broken on issue archive that uses query string in URL
-
I recently noticed that if your issue archive is being linked to/displayed with the query string in the URL instead of the nicename format (like yourdomain.com//issues/?issue=issuename ) the pagination doesn’t work. When you click on the “2” to link to the next page it just reloads the first page. I can’t link to a live example of this because the problem was on a live site that needed to be fixed ASAP, so I wrote a custom plugin that forces the issue archive page to display every article, getting rid of the need for pagination. Here’s the code I used:
add_action( ‘pre_get_posts’, ‘change_issue_archive_settings’ );
function change_issue_archive_settings($query) {
$taxQuery = $query->get(‘tax_query’);
$taxFirstArray = $taxQuery[0];if ( ! is_admin() && ($query->get(‘post_type’) == ‘article’) && ($taxFirstArray[‘taxonomy’] == ‘issuem_issue’) ) {
$query->set( ‘posts_per_page’, ‘-1’ );
}
}If you guys could fix this in the plugin so I no longer needed this workaround, that would be great. Thanks!
- The topic ‘Pagination broken on issue archive that uses query string in URL’ is closed to new replies.