WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/wp unique post slug

Contents

Description

Computes a unique slug for the post, when given the desired slug and some post details.

Usage

<?php wp_unique_post_slug$slug$post_ID$post_status$post_type$post_parent ); ?>

Parameters

$slug
(string) (required) the desired slug (post_name)
Default: None
$post_ID
(integer) (required)
Default: None
$post_status
(string) (required) no uniqueness checks are made if the post is still draft or pending
Default: None
$post_type
(string) (required)
Default: None
$post_parent
(integer) (required)
Default: None

Return Values

(string) 
unique slug for the post, based on $post_name (with a -2, -3 etc. suffix)

Change Log

Since: 2.8

Source File

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