wp_check_for_changed_slugs


wp_check_for_changed_slugs ( $post_id, $post, $post_before )

Parameters:
  • (int) post_id Post ID.
  • (WP_Post) post The post object.
  • (WP_Post) post_before The previous post object.
Defined at:

Description

Checks for changed slugs for published post objects and save the old slug.The function is used when a post object of any type is updated, by comparing the current and previous post objects. 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 logically usage of this function is redirecting changed post objects, so that those that linked to an changed post will be redirected to the new post.

Related Functions

wp_check_for_changed_dates, wp_check_locked_posts, wp_cache_get_last_changed, wp_cache_set_last_changed, wp_check_filetype_and_ext

Top Google Results

User discussions

wpseek mobile