wp_unique_post_slug
Filters the unique post slug.
Usage
add_filter( 'wp_unique_post_slug', 'wp_kama_unique_post_slug_filter', 10, 6 ); /** * Function for `wp_unique_post_slug` filter-hook. * * @param string $slug The post slug. * @param int $post_id Post ID. * @param string $post_status The post status. * @param string $post_type Post type. * @param int $post_parent Post parent ID * @param string $original_slug The original post slug. * * @return string */ function wp_kama_unique_post_slug_filter( $slug, $post_id, $post_status, $post_type, $post_parent, $original_slug ){ // filter... return $slug; }
- $slug(string)
- The post slug.
- $post_id(int)
- Post ID.
- $post_status(string)
- The post status.
- $post_type(string)
- Post type.
- $post_parent(int)
- Post parent ID
- $original_slug(string)
- The original post slug.
Changelog
Since 3.3.0 | Introduced. |
Where the hook is called
wp_unique_post_slug
wp-includes/post.php 5498
return apply_filters( 'wp_unique_post_slug', $slug, $post_id, $post_status, $post_type, $post_parent, $original_slug );