Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#12327 closed defect (bug) (fixed)

Draft pages do not show parent pages in prospective URL

Reported by: markjaquith Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Editor Keywords: has-patch tested
Focuses: Cc:


When a draft page has a parent page set, its prospective URL does not reflect that, and instead the prospective URL will appear to be that of a top level page.






This was observed on 2.9.x as well, so is likely not a regression.

Attachments (1)

12327.diff (1.0 KB) - added by duck_ 6 years ago.

Download all attachments as: .zip

Change History (8)

#1 @nacin
6 years ago

  • Milestone changed from Unassigned to 3.0

#2 @duck_
6 years ago

  • Keywords has-patch added; slug url page editor wp-admin removed

get_page_uri (wp-includes/post.php, line 2910) is passed a page id and retrieves this page from DB, this retrieved page doesn't have post_name set if it's a draft. Hierarchy handling in get_sample_permalink (wp-admin/includes/post.php) assumes that the last part of the returned uri is the page's name, so the last portion of the parent path is replaced with %pagename%.

Fix allows get_page_uri to accept post object so that the temporary post_name set in get_sample_permalink can be used.

6 years ago

#3 @blepoxp
6 years ago

Just tested. It applies cleanly to current trunk though the line numbers have changed. When I applied the patch locally it worked with a notice about the line offset.

For my future reference: In situations like these, do we need a new diff or will the changeset figure it out like it did on my computer?

#4 @nacin
6 years ago

Current is okay -- it's fine as long as it applies cleanly. We'll be applying it to our own testbeds exactly how you did.

#5 @night815
6 years ago

I can confirm that this works. One thing that isn't mentioned in the bug is you have to set the permalinks setting to something (perhaps anything?) other then the default setting for this to happen.

sorry if this is just redundant. I am new and just trying to help.

#6 @night815
6 years ago

  • Keywords tested added

#7 @nacin
6 years ago

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

(In [14399]) Handle page hierarchy when showing the sample permalink. props duck_, fixes #12327.

Note: See TracTickets for help on using tickets.