Ready to get started?Download WordPress


Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp check for changed slugs


Checked for changed slugs for published posts and save old slug.

The function is used along with form POST data. It checks for the wp-old-slug POST field. Will only be concerned with published posts and the slug actually changing.

If the slug was changed and not already part of the old slugs then it will be added to the post meta field ('_wp_old_slug') for storing old slugs for that post.

The most logical usage of this function is redirecting changed posts, so that those that linked to an changed post will be redirected to the new post.


<?php wp_check_for_changed_slugs$post_id ); ?>


(integer) (required) Post ID.
Default: None

Return Values

Same as $post_id



Change Log

Since: 2.1.0

Source File

wp_check_for_changed_slugs() is located in wp-includes/post.php.


See also index of Function Reference and index of Template Tags.