[wp-hackers] On slug change, do something

Nicholas Ciske nl at thoughtrefinery.com
Tue Jul 30 22:12:41 UTC 2013


Here's a Gist that'll do what you want using the 2 actions fired before and after a term slug is updated.
https://gist.github.com/nciske/6117419

I had to use a global variable, but it works for all taxonomies (and a transient seems like overkill for this). I'm open to suggestions for improvement.

If you just wanted to do a single taxonomy, you could use this one hook version that exploits the fact that the slug change doesn’t immediately update the object cache, so we can compare the cached version to the database:

https://gist.github.com/nciske/6117497


_________________________
Nick Ciske
http://thoughtrefinery.com/
@nciske	


More information about the wp-hackers mailing list