Opened 17 years ago
Last modified 3 months ago
#8905 assigned defect (bug)
Category pagination broken with certain permalink structures
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Future Release | Priority: | normal |
| Severity: | normal | Version: | 2.7 |
| Component: | Permalinks | Keywords: | needs-patch needs-testing close |
| 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 (18)
#5
@
16 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
@
13 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
@
13 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/2gives 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
@
11 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
@
9 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
@
5 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
#18
@
3 months ago
- Keywords close added
Hi All,
I have just tested this on my local set up running the trunk branch, and this appears to be working as it should be now.
Test Report
Description
Testing an issue with pagination with the following permalink structure: /%category%/%postname%.
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.4.7
- Server: nginx/1.27.5
- Database: mysqli (Server: 8.0.40 / Client: mysqlnd 8.4.7)
- Browser: Chrome 137.0.0.0
- OS: macOS
- Theme: Twenty Seventeen 3.9
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
Steps to Reproduce when there are posts within a category.
- Change permalink structure on the site to:
/%category%/%postname% - Navigate to a category with enough posts to require pagination.
- Using the page navigation links, go to any page beyond the first one.
- ✅ The page loads and the additional page of posts displays.
Steps to Reproduce when there are not any posts within a category .
- Change permalink structure on the site to:
/%category%/%postname% - Navigate to a category with zero posts.
- ✅ The Page displays a 404, which is identical to the other permalink structures I have tested with.
I believe this issue has now resolved over the years, and we are safe to close this ticket down? As of such I have attached the close tag. 😃
punting