Opened 12 years ago
Last modified 3 weeks ago
#30631 new defect (bug)
posts_per_page causing infinite duplicate content
| Reported by: | firebird75 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Canonical | Version: | 4.0.1 |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
While using the posts_per_page in the pre_get_posts, if you set it to -1. It will output all the posts. The issue is that if you use this with the main query on a taxonomy archive page, then it will create unlimited number of subpages with all the same content as the main page :
taxonomy-1/
taxonomy-1/page/2/
taxonomy-1/page/3/
...
taxonomy-1/page/500/
etc...
It is probably not really the expected behavior...
Change History (3)
This ticket was mentioned in PR #13232 on WordPress/wordpress-develop by skikken.
3 weeks ago
#3
- Keywords has-patch has-unit-tests added
- Paging block: new elseif - when nopaging is truthy, not singular, and paged > 1, set $limits = 'LIMIT 0'. The query returns zero rows instead of the full result set on every paginated URL.
- set_found_posts(): when $limits is non-empty and nopaging is truthy, max_num_pages = 1 (posts_per_page is -1 there and can't divide the total).
Trac ticket: https://core.trac.wordpress.org/ticket/30631
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude
Model(s): Sonnet
Used for: review and test cases
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Related: #11694, #28081, #29655.