WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#3202 closed enhancement (fixed)

"Redirect Old Slugs" should be in core.

Reported by: bryanveloso Owned by: markjaquith
Milestone: 2.1 Priority: normal
Severity: normal Version: 2.1
Component: Administration Keywords: has-patch 2nd-opinion
Focuses: 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 8 years ago.
Patch for /trunk/

Download all attachments as: .zip

Change History (11)

comment:1 @markjaquith8 years ago

  • 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.

@markjaquith8 years ago

Patch for /trunk/

comment:2 @markjaquith8 years ago

  • 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

comment:3 @Viper007Bond8 years ago

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

comment:4 @bryanveloso8 years ago

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

comment:5 @matt8 years ago

+1, go for it.

comment:6 @JeremyVisser8 years ago

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.

comment:7 @markjaquith8 years ago

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.

comment:8 @markjaquith8 years ago

  • 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 @ryan8 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

comment:10 @markjaquith8 years ago

  • 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.