Changeset 11941 for trunk/wp-includes/taxonomy.php
- Timestamp:
- 09/17/2009 02:03:57 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/taxonomy.php
r11476 r11941 1079 1079 $tt_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids'); 1080 1080 $in_tt_ids = "'" . implode("', '", $tt_ids) . "'"; 1081 do_action( 'delete_term_relationships', $object_id, $tt_ids ); 1081 1082 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id) ); 1083 do_action( 'deleted_term_relationships', $object_id, $tt_ids ); 1082 1084 wp_update_term_count($tt_ids, $taxonomy); 1083 1085 } … … 1138 1140 $parent = $term_obj->parent; 1139 1141 1142 $edit_tt_ids = $wpdb->get_col( "SELECT `term_taxonomy_id` FROM $wpdb->term_taxonomy WHERE `parent` = " . (int)$term_obj->term_id ); 1143 do_action( 'edit_term_taxonomies', $edit_tt_ids ); 1140 1144 $wpdb->update( $wpdb->term_taxonomy, compact( 'parent' ), array( 'parent' => $term_obj->term_id) + compact( 'taxonomy' ) ); 1145 do_action( 'edited_term_taxonomies', $edit_tt_ids ); 1141 1146 } 1142 1147 … … 1156 1161 } 1157 1162 1163 do_action( 'delete_term_taxonomy', $tt_id ); 1158 1164 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $tt_id ) ); 1165 do_action( 'deleted_term_taxonomy', $tt_id ); 1159 1166 1160 1167 // Delete the term if no taxonomies use it. … … 1378 1385 // The alias isn't in a group, so let's create a new one and firstly add the alias term to it. 1379 1386 $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1; 1387 do_action( 'edit_terms', $alias->term_id ); 1380 1388 $wpdb->update($wpdb->terms, compact('term_group'), array('term_id' => $alias->term_id) ); 1389 do_action( 'edited_terms', $alias->term_id ); 1381 1390 } 1382 1391 } … … 1397 1406 if ( empty($slug) ) { 1398 1407 $slug = sanitize_title($slug, $term_id); 1408 do_action( 'edit_terms', $term_id ); 1399 1409 $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); 1410 do_action( 'edited_terms', $term_id ); 1400 1411 } 1401 1412 … … 1475 1486 if ( $wpdb->get_var( $wpdb->prepare( "SELECT term_taxonomy_id FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id = %d", $object_id, $tt_id ) ) ) 1476 1487 continue; 1488 do_action( 'add_term_relationship', $object_id, $tt_id ); 1477 1489 $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $object_id, 'term_taxonomy_id' => $tt_id ) ); 1490 do_action( 'added_term_relationship', $object_id, $tt_id ); 1478 1491 } 1479 1492 … … 1484 1497 if ( $delete_terms ) { 1485 1498 $in_delete_terms = "'" . implode("', '", $delete_terms) . "'"; 1499 do_action( 'delete_term_relationships', $object_id, $delete_terms ); 1486 1500 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_delete_terms)", $object_id) ); 1501 do_action( 'deleted_term_relationships', $object_id, $delete_terms ); 1487 1502 wp_update_term_count($delete_terms, $taxonomy); 1488 1503 } … … 1647 1662 // The alias isn't in a group, so let's create a new one and firstly add the alias term to it. 1648 1663 $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1; 1664 do_action( 'edit_terms', $alias->term_id ); 1649 1665 $wpdb->update( $wpdb->terms, compact('term_group'), array( 'term_id' => $alias->term_id ) ); 1666 do_action( 'edited_terms', $alias->term_id ); 1650 1667 } 1651 1668 } … … 1661 1678 return new WP_Error('duplicate_term_slug', sprintf(__('The slug “%s” is already in use by another term'), $slug)); 1662 1679 } 1663 1680 do_action( 'edit_terms', $alias->term_id ); 1664 1681 $wpdb->update($wpdb->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) ); 1665 1666 1682 if ( empty($slug) ) { 1667 1683 $slug = sanitize_title($name, $term_id); 1668 1684 $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); 1669 1685 } 1686 do_action( 'edited_terms', $alias->term_id ); 1670 1687 1671 1688 $tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id) ); 1672 1689 do_action( 'edit_term_taxonomy', $tt_id ); 1673 1690 $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) ); 1674 1691 do_action( 'edited_term_taxonomy', $tt_id ); 1692 1675 1693 do_action("edit_term", $term_id, $tt_id); 1676 1694 do_action("edit_$taxonomy", $term_id, $tt_id); … … 1772 1790 foreach ( (array) $terms as $term) { 1773 1791 $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) ); 1792 do_action( 'edit_term_taxonomy', $term ); 1774 1793 $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); 1794 do_action( 'edited_term_taxonomy', $term ); 1775 1795 } 1776 1796 … … 2154 2174 foreach ( (array) $terms as $term ) { 2155 2175 $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term ) ); 2176 do_action( 'edit_term_taxonomy', $term ); 2156 2177 $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); 2178 do_action( 'edited_term_taxonomy', $term ); 2157 2179 } 2158 2180 }
Note: See TracChangeset
for help on using the changeset viewer.