WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/wp check for changed slugs

Contents

Description

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.

Usage

<?php wp_check_for_changed_slugs$post_id ); ?>

Parameters

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

Return Values

(integer) 
Same as $post_id

Examples

Notes

Change Log

Since: 2.1.0

Source File

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

Related

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