pre_wp_unique_post_slug filter-hook . WP 5.1.0
Filters the post slug before it is generated to be unique.
Returning a non-null value will short-circuit the unique slug generation, returning the passed value instead.
Usage
add_filter( 'pre_wp_unique_post_slug', 'filter_function_name_2324', 10, 6 ); function filter_function_name_2324( $override_slug, $slug, $post_ID, $post_status, $post_type, $post_parent ){ // filter... return $override_slug; }
- $override_slug(string/null)
- Short-circuit return value.
- $slug(string)
- The desired slug (post_name).
- $post_ID(int)
- Post ID.
- $post_status(string)
- The post status.
- $post_type(string)
- Post type.
- $post_parent(int)
- Post parent ID.
Changelog
Since 5.1.0 | Introduced. |
Where the hook is called
pre_wp_unique_post_slug
wp-includes/post.php 4562
$override_slug = apply_filters( 'pre_wp_unique_post_slug', null, $slug, $post_ID, $post_status, $post_type, $post_parent );