wp_unique_term_slug_is_bad_slug
Filters whether the proposed unique term slug is bad.
Usage
add_filter( 'wp_unique_term_slug_is_bad_slug', 'wp_kama_unique_term_slug_is_bad_filter', 10, 3 ); /** * Function for `wp_unique_term_slug_is_bad_slug` filter-hook. * * @param bool $needs_suffix Whether the slug needs to be made unique with a suffix. * @param string $slug The slug. * @param object $term Term object. * * @return bool */ function wp_kama_unique_term_slug_is_bad_filter( $needs_suffix, $slug, $term ){ // filter... return $needs_suffix; }
- $needs_suffix(true|false)
- Whether the slug needs to be made unique with a suffix.
- $slug(string)
- The slug.
- $term(object)
- Term object.
Changelog
Since 4.3.0 | Introduced. |
Where the hook is called
wp_unique_term_slug_is_bad_slug
wp-includes/taxonomy.php 3130
if ( apply_filters( 'wp_unique_term_slug_is_bad_slug', $needs_suffix, $slug, $term ) ) {