WordPress at Your Fingertips
filter is not described

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.


add_filter( 'pre_wp_unique_post_slug', 'filter_function_name_4068', 10, 6 );
function filter_function_name_4068( $override_slug, $slug, $post_ID, $post_status, $post_type, $post_parent ){
	// filter...

	return $override_slug;
Short-circuit return value.
The desired slug (post_name).
Post ID.
The post status.
Post type.
Post parent ID.

Where the hook is called

wp-includes/post.php 4758
$override_slug = apply_filters( 'pre_wp_unique_post_slug', null, $slug, $post_ID, $post_status, $post_type, $post_parent );

Where in WP core the hook is used WordPress

wp-includes/default-filters.php 665
add_filter( 'pre_wp_unique_post_slug', 'wp_filter_wp_template_unique_post_slug', 10, 5 );