WordPress.org

Make WordPress Core

Ticket #20783: 20783.diff

File 20783.diff, 1.2 KB (added by coffee2code, 22 months ago)
  • wp-includes/taxonomy.php

     
    22332233 * @subpackage Taxonomy 
    22342234 * @since 2.3.0 
    22352235 * @uses $wpdb 
     2236 * @uses apply_filters() Will call the 'wp_unique_term_slug' filter and pass 
     2237 *  the resulting unique slug, the term, and the original slug. 
    22362238 * 
    22372239 * @param string $slug The string that will be tried for a unique slug 
    2238  * @param object $term The term object that the $slug will belong too 
     2240 * @param object $term The term object that the $slug will belong to 
    22392241 * @return string Will return a true unique slug. 
    22402242 */ 
    22412243function wp_unique_term_slug($slug, $term) { 
     
    22442246        if ( ! term_exists( $slug ) ) 
    22452247                return $slug; 
    22462248 
     2249        $original_slug = $slug; 
     2250 
    22472251        // If the taxonomy supports hierarchy and the term has a parent, make the slug unique 
    22482252        // by incorporating parent slugs. 
    22492253        if ( is_taxonomy_hierarchical($term->taxonomy) && !empty($term->parent) ) { 
     
    22782282                $slug = $alt_slug; 
    22792283        } 
    22802284 
    2281         return $slug; 
     2285        return apply_filters( 'wp_unique_term_slug', $slug, $term, $original_slug ); 
    22822286} 
    22832287 
    22842288/**