Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#15041 closed defect (bug) (fixed)

Page auto-draft & guid generation

Reported by: shawnparker Owned by:
Priority: highest omg bbq Milestone: 3.1
Component: Permalinks Version: 3.0.1
Severity: critical Keywords: has-patch needs-testing
Cc: shawnparker

Description

Guid generation for pages is currently broken. auto-draft status is currently not handled and all page guids are simply the base site_url instead of site_url + ?page_id=000.

I looks as if auto-drafts were handled for posts here: http://core.trac.wordpress.org/changeset/14948

Attached is a patch for the _get_page_link() function in wp-includes/link-template.php to account for a post_status of auto-draft and properly generate the guid for pages (patch is to 3.0.1 tag, but issue exists in the same function in 3.0 branch and trunk as well).

Attachments (2)

page-auto-draft-fix.diff (925 bytes) - added by shawnparker 3 years ago.
REVISED auto draft fix for pages
page-auto-draft-fix.2.diff (806 bytes) - added by SergeyBiryukov 2 years ago.
Moved the check to the proper place

Download all attachments as: .zip

Change History (15)

REVISED auto draft fix for pages

  • Cc shawnparker added
  • Keywords has-patch needs-testing added; page auto-draft guid removed
  • Milestone changed from Awaiting Review to 3.0.2

The change that patch wants to make to line 283 needs modification. I took that from the post permalink function and forgot to change $post_link to $link.

  • Milestone changed from 3.0.3 to 3.1

comment:6   ryan2 years ago

  • Milestone changed from 3.1 to Future Release

Punting all tickets that are not regressions in 3.1.

  • Milestone changed from Future Release to 3.1

Per IRC. This is a nasty bug for anyone using feeds in any regard for pages. Rare, but I'm sure someone does, perhaps for child pages or something.

Might we need to run an upgrade script to update old page GUIDs, too?

  • Priority changed from normal to highest omg bbq
  • Severity changed from major to critical

comment:9   ryan2 years ago

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

(In [17061]) Fix guid generation for page auto drafts. Props shawnparker. fixes #15041

  • Resolution fixed deleted
  • Status changed from closed to reopened

For [17061]: The check for

isset($post->post_status)

in line 192 comes after $post->post_status has already been used to create $draft_or_pending in line 188, which is to late to avaid notices.

Thus, the check should be part of the $draft_or_pending conditional in line 188.

Moved the check to the proper place

Added new patch.

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

(In [17076]) Relocate isset check. Props TobiasBg, SergeyBiryukov. fixes #15041

Great catch

Note: See TracTickets for help on using tickets.