Opened 3 years ago
Closed 3 years ago
#12906 closed defect (bug) (invalid)
paged broken with post_type set?
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Query | Version: | 3.0 |
| Severity: | normal | Keywords: | reporter-feedback |
| Cc: |
Description
querying a list of posts using index.php?post_type=post, pagination does not work. If paged is set, the view is marked as being "is_404".
To reproduce, go to index.php?post_type=post&paged=2
Change History (11)
comment:3
scribu
— 3 years ago
- Keywords reporter-feedback added
Have you tried disabling all plugins and switching to the default theme?
comment:4
Silkjaer
— 3 years ago
Yes. All plugins deactivated, standard theme, no custom post types created through functions.php or anything. www.exampleblog.com/?post_type=post&paged=2 results in a 404.
My current WP revision is r14032
comment:5
Silkjaer
— 3 years ago
Researched a little further. When i do www.exampleblog.com/?post_type=post, the queryvar "p", and "page_id" is set to "1". The page with id 1 is the page i defined for being my blog static home page.
That id is defined on line 1489 of query.php:
$qv['page_id'] = get_option('page_on_front');
By commenting this, paging works again. So the bug is somehow related to WP thinking that ?post_type=post == is_home()?
comment:6
scribu
— 3 years ago
Do you have home set to be a static page?
Also, does ?paged=2 work as expected?
comment:7
Silkjaer
— 3 years ago
Yes, home is a static page.
doing just ?paged=2 doesn't make any visual changes, since the page is static, but if i output the $wp_query i see that 'is_paged" is '1'.
'is_paged' is unset in the other case.
comment:8
scribu
— 3 years ago
Having home set to a static page and then going to ?post_type=post&paged=2 doesn't really make sense.
Maybe if you had a (public) custom post type instead of 'post'.
comment:9
Silkjaer
— 3 years ago
I have 5 additional custom post types, and would like to present them differently. So actually the query in my case looks like ?post_type=review&paged=2
By adding custom post types to WP, you should expect you were able to list them as well.
comment:10
dd32
— 3 years ago
You will be able to list them, just not on a static page (Unless that page has a loop in it).
You'll need to use /page-for-blog-posts/?post_type=review instead.
Your best bet, is to make a /review/ page, add a custom template with a proper loop in it.
I'm tempted to close this as invalid myself, due to the above comments and the fact its a static page.
comment:11
nacin
— 3 years ago
- Milestone 3.0 deleted
- Resolution set to invalid
- Status changed from new to closed
Can't reproduce using r14040.