Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#17033 closed defect (bug) (invalid)

Archive of pages uses home.php template

Reported by: ptahdunbar's profile ptahdunbar Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

via michael@… on wphackers

Running the following query from the location bar will produce a list of
all pages on a site: ?post_type=page. In the event that the theme has a
home.php template, this template will be used to display the archive. I
believe that home.php is intended to be used only when the "Blog" is being
queried (posts with a post_type of "post" with no modifiers). All custom
post types fall back to index.php if there is no dedicated template
however, pages are somehow triggering home.php.

The bug is due to the page post type not having a has_archive defined. patch provided.

Attachments (1)

ticket.17033.diff (485 bytes) - added by ptahdunbar 14 years ago.

Download all attachments as: .zip

Change History (7)

#1 follow-up: @nacin
14 years ago

  • Keywords close added

I've replied to the thread. This isn't a bug, and that wouldn't be the fix. Pages don't have archives; ending up on home.php is the proper drill-down behavior.

http://lists.automattic.com/pipermail/wp-testers/2011-April/014149.html

#2 @scribu
14 years ago

  • Keywords dev-feedback added; has-patch close removed

I agree that ticket.17033.diff wouldn't be a correct fix in any case.

This isn't a bug in the template hierarchy, as nacin said.

However, if pages don't have archives, then shouldn't ?post_type=page be ignored completely? i.e. stripped out before it reaches $wp_query.

This should of course apply to all archive-less public post types.

Last edited 14 years ago by scribu (previous) (diff)

#3 @scribu
14 years ago

The idea would be that a random visitor shouldn't be able to get a list of pages via URL, unless it's explicitly enabled by a plugin.

#4 in reply to: ↑ 1 @ptahdunbar
14 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Replying to nacin:

I've replied to the thread. This isn't a bug, and that wouldn't be the fix. Pages don't have archives; ending up on home.php is the proper drill-down behavior.

http://lists.automattic.com/pipermail/wp-testers/2011-April/014149.html

Hmm. Well it just seems like a weird behavior for home.php but after reading your reply in the mailing list, I guess I didn't understand it's correct behavior.

#5 @scribu
14 years ago

  • Keywords dev-feedback removed

Follow-up: #17040

#6 @scribu
14 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.