Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_unique_term_slug_is_bad_slug

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
3045      /**
3046       * Filters whether the proposed unique term slug is bad.
3047       *
3048       * @since 4.3.0
3049       *
3050       * @param bool   $needs_suffix Whether the slug needs to be made unique with a suffix.
3051       * @param string $slug         The slug.
3052       * @param object $term         Term object.
3053       */
3054      if ( apply_filters( 'wp_unique_term_slug_is_bad_slug', $needs_suffix, $slug, $term ) ) {
3055           if ( $parent_suffix ) {
3056                $slug .= $parent_suffix;
3057           }
3058
3059           if ( ! empty( $term->term_id ) ) {
3060                $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $term->term_id );
3061           } else {
3062                $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $slug );
3063           }