WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 9 months ago

#35352 closed defect (bug) (wontfix)

URL / Slug does not get updated when title is changed

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

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 5 years ago.
Post Title and Permalink
Post Name Update ReSlug Permalink.png (13.2 KB) - added by lukecavanagh 5 years ago.
Post Name matched in Slug before post save

Download all attachments as: .zip

Change History (14)

#1 @chriscct7
6 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
6 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
6 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
5 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
5 years ago

Post Title and Permalink

#5 follow-up: @lukecavanagh
5 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 5 years ago by lukecavanagh (previous) (diff)

#6 @lukecavanagh
5 years ago

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

#7 in reply to: ↑ 5 @SergeyBiryukov
5 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
5 years ago

@SergeyBiryukov

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

#9 @lukecavanagh
5 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 5 years ago by lukecavanagh (previous) (diff)

@lukecavanagh
5 years ago

Post Name matched in Slug before post save

#10 in reply to: ↑ 8 @SergeyBiryukov
5 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
4 years ago

  • Milestone set to Awaiting Review

#12 @hellofromTonya
9 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from reopened to closed

An updated post title of a published post does not change the slug on purpose. Why? To avoid 404s when the original URL is made. If the post slug needs to be updated, it can be done manually. But then the original slug and its URL will need to be considered too, ie possibly adding a redirect to point it to the new slug.

I'm closing this ticket as the behavior is as expected and it's been over 4 years since it was marked for close.

Note: See TracTickets for help on using tickets.