Opened 7 years ago

Closed 6 years ago

#3202 closed enhancement (fixed)

"Redirect Old Slugs" should be in core.

Reported by: bryanveloso Owned by: markjaquith
Priority: normal Milestone: 2.1
Component: Administration Version: 2.1
Severity: normal Keywords: has-patch 2nd-opinion
Cc:

Description

http://txfx.net/code/wordpress/redirect-old-slugs/

Simply, this should be in core, there's no reason why any WP installation should be without this.

Attachments (1)

redirect-old-slugs.diff (4.7 KB) - added by markjaquith 7 years ago.
Patch for /trunk/

Download all attachments as: .zip

Change History (11)

  • Status changed from new to assigned

You're just saying that because I have commit access. :-P

Okay, I can't lie. It's a brilliant plugin, and you're right.

Patch for /trunk/

  • Keywords has-patch 2nd-opinion added

Patch is up.

  • New meta key (_wp_old_slug) which will be hidden (it should just WORK without people even seeing it)
  • People who were using the plugin will have their old slugs updated to the new meta key on upgrade
  • uses wp_redirect($link, '301') now
  • Only works on posts. There doesn't seem to be a clean way of recognizing failed Page attempts... of course there is always my "Page Links To" plugin to take care of that. ;-)
  • Works completely through filters.

I'm obviously biased, so I'm going to need some +1's here

Gets my vote. Helps the noobs and people like me who can't spell. :)

Yea, why isn't that one in core either? :P

comment:5   matt6 years ago

+1, go for it.

If you're going to commit this, can you also make the slug automatically update to reflect the post title when the post title is changed? I believe the reason the slug wasn't updated to reflect an updated post title was to not break links, but if this is committed, that won't be an issue.

JeremyVisser,

Hm, probably not a great idea. It'd cause a lot of unnecessary redirects. Take for instance the rather common practice of updating "Post Title" to "Post Title (UPDATED!)" ... that shouldn't cause a slug change, because, well, it doesn't make sense to have "updated" in the slug, it'll break caching, and it could cause the link to lose a bit of Google juice.

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

(In [4556]) Remember old post slugs and automatically redirect to the new slug. fixes #3202

comment:9   ryan6 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I see this when updating the slug on a published post.

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /var/www/weblog/wp-admin/admin-functions.php on line 2094

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

(In [4571]) cast to array when checking for old post slugs. fixes #3202

Note: See TracTickets for help on using tickets.