diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-26 18:11:56 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-26 18:11:56 +0000 |
commit | a6f0d9894b9d750dd26b9ce35351c605c0916d39 (patch) | |
tree | 3434c86b9d1f00f5ddfe749414d5971b5e22da22 /wp-includes | |
parent | a73705a087d75e78f101abf58b4f1db2ac867182 (diff) | |
download | wordpress-mu-a6f0d9894b9d750dd26b9ce35351c605c0916d39.tar.gz wordpress-mu-a6f0d9894b9d750dd26b9ce35351c605c0916d39.tar.xz wordpress-mu-a6f0d9894b9d750dd26b9ce35351c605c0916d39.zip |
added new "pre_update_term" filter to wp_update_term()
Added "sync_slugs" function to make slugs = sanitized name
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1137 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r-- | wp-includes/taxonomy.php | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 57b7b2d..3bc1429 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1034,8 +1034,8 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) { // expected_slashed ($name) $name = stripslashes($name); - // slug is always santized name in WordPress MU - $slug = sanitize_title($name); + if ( empty($slug) ) + $slug = sanitize_title($name); $term_group = 0; if ( $alias_of ) { @@ -1229,6 +1229,7 @@ function wp_update_term( $term, $taxonomy, $args = array() ) { return new WP_Error('invalid_taxonomy', __('Invalid taxonomy')); $term_id = (int) $term; + $args = apply_filters( 'pre_update_term', $term, $taxonomy, $args ); // First, get all of the original args $term = get_term ($term_id, $taxonomy, ARRAY_A); @@ -1244,9 +1245,11 @@ function wp_update_term( $term, $taxonomy, $args = array() ) { $args = sanitize_term($args, $taxonomy, 'db'); extract($args, EXTR_SKIP); - // slug is always santized name in WordPress MU - $empty_slug = true; - $slug = sanitize_title($name); + $empty_slug = false; + if ( empty($slug) ) { + $empty_slug = true; + $slug = sanitize_title($name); + } if ( $alias_of ) { $alias = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $alias_of) ); |