Make WordPress Core

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#29431 closed defect (bug) (fixed)

Brand new auto-drafts with no title or content inserted into database with ugly URL

Reported by: henrywright's profile henry.wright Owned by: chriscct7's profile chriscct7
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.9.2
Component: Posts, Post Types Keywords: has-patch commit
Focuses: Cc:

Description (last modified by SergeyBiryukov)

My posts can be accessed by ID. For example example.com/176

If I select Pages > Add new then wait for a few moments without typing a title or content, a row gets written to the database. I can see post_title is Auto Draft, post_status is auto-draft.

Let's say that page's ID is 177. If I now try to go to example.com/177 I get redirected to an ugly URL such as example.com/?page_id=177 and shown a 404 message.

1) Should brand new completely empty auto-draft posts be written to the database?

2) Is there a need to redirect to the ugly URL? i.e. why can't the 404 message be shown at example.com/177

Attachments (1)

29431.patch (790 bytes) - added by SergeyBiryukov 10 years ago.

Download all attachments as: .zip

Change History (13)

#1 @SergeyBiryukov
10 years ago

  • Component changed from General to Posts, Post Types

#2 @SergeyBiryukov
10 years ago

Should brand new completely empty auto-draft posts be written to the database?

Related: #14588, #18800, #19079, #19310.

#3 @henry.wright
10 years ago

Edit request

The line

I get redirected to an ugly URL such as example.com/?page_id=252 and shown a 404 message.

Should read

I get redirected to an ugly URL such as example.com/?page_id=177 and shown a 404 message

#4 @SergeyBiryukov
10 years ago

  • Description modified (diff)

#5 @henry.wright
10 years ago

Thanks SergeyBiryukov!

#6 @SergeyBiryukov
10 years ago

  • Keywords has-patch added

29431.patch fixes point 2.

#7 @henry.wright
10 years ago

Tested 29431.patch and can confirm it fixes point 2.

#8 @chriscct7
9 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 4.4

Patch is still good to go

#9 @chriscct7
9 years ago

  • Owner set to chriscct7
  • Status changed from new to accepted

#10 @wonderboymusic
9 years ago

This redirect no longer happens? I can't reproduce...

#11 @wonderboymusic
9 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 35480:

Canonical: when /%post_id%/ is the permalink structure, don't redirect IDs that match Auto Drafts.

Props SergeyBiryukov.
Fixes #29431.

#12 @chriscct7
9 years ago

(in order to reproduce it, you have to set your permalinks structure to be example/(id) so /%post_id%

Note: See TracTickets for help on using tickets.