Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#12906 closed defect (bug) (invalid)

paged broken with post_type set?

Reported by: Silkjaer Owned by: ryan
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Query Keywords: reporter-feedback
Focuses: Cc:


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)

#1 @scribu
11 years ago

  • Milestone set to 3.0

#2 @scribu
11 years ago

  • Keywords paged post_type removed

Can't reproduce using r14040.

#3 @scribu
11 years ago

  • Keywords reporter-feedback added

Have you tried disabling all plugins and switching to the default theme?

#4 @Silkjaer
11 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

#5 @Silkjaer
11 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()?

#6 @scribu
11 years ago

Do you have home set to be a static page?

Also, does ?paged=2 work as expected?

#7 @Silkjaer
11 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.

#8 @scribu
11 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'.

#9 @Silkjaer
11 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.

#10 @dd32
11 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.

#11 @nacin
11 years ago

  • Milestone 3.0 deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.