WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#6072 closed defect (bug) (fixed)

Write Post: Permalink should not be "undefined" if I click Edit, clear the field, and then click Save

Reported by: lloydbudd Owned by: nbachiyski
Milestone: 2.5 Priority: normal
Severity: normal Version: 2.5
Component: General Keywords: has-patch
Focuses: Cc:

Description

Write Post: Permalink should not be "undefined" if I click Edit, clear the field, and then click Save

ENV: WP trunk r7133 (2.5-beta1)

The result is Permalink: http://example.com/undefined/ [Edit]

But it doesn't actually save any change thankfully.

The expectation is that a new permalink is created based on the current post title.

ADDITIONAL DETAIL

Specifically, after publishing a post. I decide I want to change the title, and I want the URL to be updated as well. That is where my expectation comes from, and previous versions of WP worked in this manner.

Attachments (2)

act-right-on-empty-slug.diff (3.1 KB) - added by nbachiyski 7 years ago.
really-act-right-on-empty-slug.diff (2.5 KB) - added by nbachiyski 7 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 @nbachiyski7 years ago

  • Keywords has-patch added

Lloyd, I totally agree. The patch hopefully meets these expectations.

comment:2 @ryan7 years ago

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

(In [7139]) Slug edit fix from nbachiyski. fixes #6072

comment:3 @ryan7 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This causes draft permalinks to show the post ID instead of the slug.

comment:4 @nbachiyski7 years ago

The main problem was that autosave didn't pass the title, so that the correct slug can be computed. Moreover, I had some stupid holes in the logic.

Tested in the following conditions:

  • New post -> Automatic autosave -- uses the title at the moment of autosave
  • Draft -> Edit slug
  • Draft -> Edit slug and then save -- there was a problem in that case (used empty slug), which I found and fixed
  • Published post -> Set a new slug
  • Any post -> Set empty slug -- fallbacks to current title as Lloyd suggested

comment:5 @markjaquith7 years ago

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

(In [7162]) Post slug fixes from nbachiyski. fixes #6072

Note: See TracTickets for help on using tickets.