Ticket #3202 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

"Redirect Old Slugs" should be in core.

Reported by: bryanveloso Assigned to: 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

redirect-old-slugs.diff (4.7 kB) - added by markjaquith on 10/04/06 14:15:02.
Patch for /trunk/

Change History

10/04/06 10:37:25 changed by markjaquith

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

10/04/06 14:15:02 changed by markjaquith

  • attachment redirect-old-slugs.diff added.

Patch for /trunk/

10/04/06 14:20:29 changed by markjaquith

  • keywords set to has-patch 2nd-opinion.

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

10/04/06 17:26:58 changed by Viper007Bond

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

10/11/06 07:25:42 changed by bryanveloso

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

11/30/06 00:04:00 changed by matt

+1, go for it.

11/30/06 00:28:11 changed by JeremyVisser

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.

11/30/06 08:31:52 changed by markjaquith

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.

11/30/06 08:48:59 changed by markjaquith

  • status changed from assigned to closed.
  • resolution set to fixed.

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

11/30/06 20:23:57 changed by ryan

  • status changed from closed to reopened.
  • resolution deleted.

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

12/01/06 04:51:11 changed by markjaquith

  • status changed from reopened to closed.
  • resolution set to fixed.

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