wp_unique_term_slug_is_bad_slug
Filter HookDescription
Filters whether the proposed unique term slug is bad.Hook Information
File Location |
wp-includes/taxonomy.php
View on GitHub
|
Hook Type | Filter |
Line Number | 3141 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool
|
$needs_suffix
|
Whether the slug needs to be made unique with a suffix. |
string
|
$slug
|
The slug. |
object
|
$term
|
Term object. |
Usage Examples
Basic Usage
<?php
// Hook into wp_unique_term_slug_is_bad_slug
add_filter('wp_unique_term_slug_is_bad_slug', 'my_custom_filter', 10, 3);
function my_custom_filter($needs_suffix, $slug, $term) {
// Your custom filtering logic here
return $needs_suffix;
}
Source Code Context
wp-includes/taxonomy.php:3141
- How this hook is used in WordPress core
<?php
3136 *
3137 * @param bool $needs_suffix Whether the slug needs to be made unique with a suffix.
3138 * @param string $slug The slug.
3139 * @param object $term Term object.
3140 */
3141 if ( apply_filters( 'wp_unique_term_slug_is_bad_slug', $needs_suffix, $slug, $term ) ) {
3142 if ( $parent_suffix ) {
3143 $slug .= $parent_suffix;
3144 }
3145
3146 if ( ! empty( $term->term_id ) ) {
PHP Documentation
<?php
/**
* Filters whether the proposed unique term slug is bad.
*
* @since 4.3.0
*
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/taxonomy.php
Related Hooks
Related hooks will be displayed here in future updates.