WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 3 years ago

#35352 reopened defect (bug)

URL / Slug does not get updated when title is changed

Reported by: webifish Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.4.1
Component: Permalinks Keywords: reporter-feedback close
Focuses: administration Cc:
PR Number:

Description

BUG IMO:

  1. create a post in WP and insert it's title
  2. Slug / URL is created
  3. Edit the title

–> Slug does not change / Update –> Slug does not change either

Attachments (2)

Post Title and Permalink.png (11.5 KB) - added by lukecavanagh 3 years ago.
Post Title and Permalink
Post Name Update ReSlug Permalink.png (13.2 KB) - added by lukecavanagh 3 years ago.
Post Name matched in Slug before post save

Download all attachments as: .zip

Change History (13)

#1 @chriscct7
4 years ago

  • Keywords close 2nd-opinion added

Once the url is generated the first time, the url will not change with title changes later.

This is functioning as expected if I understand the ticket.

Hypothetical situation:

  1. News site publishes an article and shares links everywhere.
  2. News site changes the title
  3. Just the title changes, not the URL. Changing the URL would mean all previous links that News site had sent out would be broken.

To change the url, it can be done manually by using the "Edit" button next to the permalink

#2 @webifish
4 years ago

Right - agree. but this is just one scenario imagine this (actually how I came across this):

  1. News site author is writing a long post and gives it a title
  2. While editing the content the author decides to change the title because some important keywords he just added seems better than the original title
  3. Author publishes the post

Now autor has a URL different than the title and that hasn't got the best slug.

#3 @johnbillion
4 years ago

  • Component changed from General to Permalinks
  • Keywords reporter-feedback added; 2nd-opinion removed

While a post is unpublished (eg. in draft), the post slug changes whenever the title is changed and the post is saved. Only once the post is published does the slug become fixed.

@webifish Are you seeing different behaviour?

#4 @swissspidy
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

While a post is unpublished (eg. in draft), the post slug changes whenever the title is changed and the post is saved. Only once the post is published does the slug become fixed.

I can confirm this behaviour on a clean install of trunk and WordPress 4.7.

@lukecavanagh
3 years ago

Post Title and Permalink

#5 follow-up: @lukecavanagh
3 years ago

@webifish

Same behaviour on a clean install of WP 4.7.3 on local dev, on a already published post. When the post title is changed and updated, the permalink will not be updated to match the new post title.

Last edited 3 years ago by lukecavanagh (previous) (diff)

#6 @lukecavanagh
3 years ago

  • Keywords needs-patch added; close removed
  • Resolution worksforme deleted
  • Status changed from closed to reopened

#7 in reply to: ↑ 5 @SergeyBiryukov
3 years ago

  • Keywords close added; needs-patch removed

Replying to lukecavanagh:

Same behaviour on a clean install of WP 4.7.3 on local dev, on a already published post.

Published posts have a fixed slug unless it's explicitly edited manually, see comment:3.

#8 follow-up: @lukecavanagh
3 years ago

@SergeyBiryukov

Why does a published post slug have to be fixed though?

#9 @lukecavanagh
3 years ago

@SergeyBiryukov

I was able to find this method.
http://wordpress.stackexchange.com/questions/135931/reslug-a-custom-post-type/136099#136099

Forked updated version of the re-slug plugin
https://github.com/lukecav/re-slug
https://wordpress.org/plugins/re-slug/

Works in WP 4.7.3 on local dev, so if you edit the post name, then hit the re-slug button next to Edit near the slug metabox, it will update the slug to match the post name before post save.

Last edited 3 years ago by lukecavanagh (previous) (diff)

@lukecavanagh
3 years ago

Post Name matched in Slug before post save

#10 in reply to: ↑ 8 @SergeyBiryukov
3 years ago

Replying to lukecavanagh:

Why does a published post slug have to be fixed though?

To avoid breaking existing links?

Posts can redirect from old slugs, but pages cannot (see #4328), so it's good to have that extra step to make sure the slugs for any published content are only changed when intended.

#11 @SergeyBiryukov
3 years ago

  • Milestone set to Awaiting Review
Note: See TracTickets for help on using tickets.