Opened 16 years ago
Last modified 4 years ago
#8905 assigned defect (bug)
Category pagination broken with certain permalink structures
Reported by: | rmccue | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 2.7 |
Component: | Permalinks | Keywords: | needs-patch needs-testing |
Focuses: | Cc: |
Description
If one uses a permalink structure with %category% followed by %postname%, accessing pagination can cause a 404, as WordPress attempts to look for a post called "page".
As per http://barefootdevelopment.blogspot.com/2007/11/fix-for-wordpress-paging-problem.html
Presumably can occur with other permalink structures too.
Change History (17)
#5
@
15 years ago
Ran into this issue today - would love to see a fix.
I'm not sure if it is as simple as putting some extra logic in parse_request()? Using Doug Smith's code as inspiration, I added the following right before $this->query_vars = apply_filters('request', $this->query_vars); :
if ($this->query_vars['name'] === 'page' && isset($this->query_vars['page'])) { unset($this->query_vars['name']); $this->query_vars['paged'] = str_replace('/', '', $this->query_vars['page']); }
Thoughts?
#8
@
12 years ago
- Keywords needs-patch removed
- Milestone Future Release deleted
- Resolution set to worksforme
- Status changed from new to closed
http://wordpress-core/uncategorized/test-post-goes-here-this-is-some-more/2/ totally works for me when using <!--nextpage-->
and navigating to page 2
#10
@
12 years ago
- Keywords needs-patch added
- Milestone set to Future Release
- Resolution worksforme deleted
- Status changed from closed to reopened
This ticket is about category pagination, not single post pagination.
As noted in #21209, the issue still can be reproduced with bare category slugs:
- Set permalink structure to
/%category%/%postname%/
. http://mysite/mycat/page/2
gives a 404 error.
Debug Bar info:
Request: mycat/page/2 Query String: page=%2F2&name=page&category_name=mycat Matched Rewrite Rule: (.+?)/([^/]+)(/[0-9]+)?/?$ Matched Rewrite Query: category_name=mycat&name=page&page=%2F2
#13
@
10 years ago
This is already fixed. Unless there is some new issue that is not clear here, then this should probably be closed. @SergeyBiryukov's reproduction steps produce the second page now, not a 404. It's not my place to close this, but I'm pretty sure it can be closed as resolved.
#15
@
8 years ago
- Keywords close removed
When there's a post with the slug page
, http://mysite/mycat/page/2
shows that post. If there's none, I get a 404.
#17
@
4 years ago
Hi there,
Paginate_links function inside page template works fine. I can display a category with pagination using a page template pagetemplate-categoryname.php but not a category-categoryname.php, or even the root category.php template in a theme.
For slug page mentioned above the paginate_links would look like this:
<?php echo paginate_links( array( 'format' => 'page/%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $wp_query->max_num_pages, 'prev_next' => True, 'prev_text' => __("<i class=\"material-icons\">chevron_left</i>"), 'next_text' => __("<i class=\"material-icons\">chevron_right</i>"), 'type' => 'list', )); ?>
There is a "category pagination fix" plugin being offered for category pagination when this should be part of core features of a content management system:
https://wordpress.org/support/plugin/category-pagination-fix/reviews/
Thank you for your time.
Regards,
Zeshan
punting