Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#17176 closed defect (bug) (fixed)

WP_Rewrite::page_uri_index() includes auto-drafts

Reported by: duck_'s profile duck_ Owned by:
Milestone: 3.2 Priority: normal
Severity: normal Version:
Component: Rewrite Rules Keywords: has-patch
Focuses: Cc:

Description

The query results passed to get_page_hierarchy() includes auto-drafts. This means that when verbose page rules are in use there are several useless rewrite rules created:

()/trackback/?$ => index.php?pagename=$matches[1]&tb=1
()/feed/(feed|rdf|rss|rss2|atom)/?$ => index.php?pagename=$matches[1]&feed=$matches[2]
()/(feed|rdf|rss|rss2|atom)/?$ => index.php?pagename=$matches[1]&feed=$matches[2]
()/page/?([0-9]{1,})/?$ => index.php?pagename=$matches[1]&paged=$matches[2]
()/comment-page-([0-9]{1,})/?$ => index.php?pagename=$matches[1]&cpage=$matches[2]
()(/[0-9]+)?/?$ => index.php?pagename=$matches[1]&page=$matches[2]

Steps:

  1. Visit add new page to create an auto-draft
  2. Go to options-permalinks.php and enable a verbose structure

Attachments (1)

17176.diff (650 bytes) - added by duck_ 13 years ago.

Download all attachments as: .zip

Change History (6)

@duck_
13 years ago

#1 @duck_
13 years ago

I *think* this query might actually scan fewer rows since it's able to use another element of the type_status_date KEY.

#2 @nacin
13 years ago

  • Milestone changed from Awaiting Review to 3.2

#3 @nacin
13 years ago

Should we exclude any other stati?

#4 @nacin
13 years ago

In [17929]:

Don't fetch auto-draft pages in WP_Rewrite::page_uri_index(). props duck_, see #17176.

#5 @ryan
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.