wp_unique_post_slug_is_bad_attachment_slug
Filters whether the post slug would make a bad attachment slug.
Usage
add_filter( 'wp_unique_post_slug_is_bad_attachment_slug', 'wp_kama_unique_post_slug_is_bad_attachment_filter', 10, 2 ); /** * Function for `wp_unique_post_slug_is_bad_attachment_slug` filter-hook. * * @param bool $bad_slug Whether the slug would be bad as an attachment slug. * @param string $slug The post slug. * * @return bool */ function wp_kama_unique_post_slug_is_bad_attachment_filter( $bad_slug, $slug ){ // filter... return $bad_slug; }
- $bad_slug(true|false)
- Whether the slug would be bad as an attachment slug.
- $slug(string)
- The post slug.
Changelog
Since 3.1.0 | Introduced. |
Where the hook is called
wp_unique_post_slug_is_bad_attachment_slug
wp-includes/post.php 5208
$is_bad_attachment_slug = apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug );