wp_unique_post_slug_is_bad_hierarchical_slug filter-hookWP 3.1.0

Filters whether the post slug would make a bad hierarchical post slug.

Usage

add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', 'wp_kama_unique_post_slug_is_bad_hierarchical_filter', 10, 4 );

/**
 * Function for `wp_unique_post_slug_is_bad_hierarchical_slug` filter-hook.
 * 
 * @param bool   $bad_slug    Whether the post slug would be bad in a hierarchical post context.
 * @param string $slug        The post slug.
 * @param string $post_type   Post type.
 * @param int    $post_parent Post parent ID.
 *
 * @return bool
 */
function wp_kama_unique_post_slug_is_bad_hierarchical_filter( $bad_slug, $slug, $post_type, $post_parent ){

	// filter...
	return $bad_slug;
}
$bad_slug(true|false)
Whether the post slug would be bad in a hierarchical post context.
$slug(string)
The post slug.
$post_type(string)
Post type.
$post_parent(int)
Post parent ID.

Changelog

Since 3.1.0 Introduced.

Where the hook is called

wp_unique_post_slug()
wp_unique_post_slug_is_bad_hierarchical_slug
wp-includes/post.php 5026
$is_bad_hierarchical_slug = apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent );

Where the hook is used in WordPress

Usage not found.