Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: edited_term_taxonomy

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

This hook occurs 3 times in this file.

Line Code
1685      if ( empty($slug) ) {
1686           $slug = sanitize_title($name, $term_id);
1687           $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) );
1688      }
1689      do_action( 'edited_terms', $term_id );
1690
1691      $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) );
1692      do_action( 'edit_term_taxonomy', $tt_id );
1693      $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) );
1694      do_action( 'edited_term_taxonomy', $tt_id );
1695
1696      do_action("edit_term", $term_id, $tt_id, $taxonomy);
1697      do_action("edit_$taxonomy", $term_id, $tt_id);
1698
1699      $term_id = apply_filters('term_id_filter', $term_id, $tt_id);
1700
1701      clean_term_cache($term_id, $taxonomy);
1702
1703      do_action("edited_term", $term_id, $tt_id, $taxonomy);
 
Line Code
1788      $taxonomy = get_taxonomy($taxonomy);
1789      if ( !empty($taxonomy->update_count_callback) ) {
1790           call_user_func($taxonomy->update_count_callback, $terms);
1791      } else {
1792           // Default count updater
1793           foreach ( (array) $terms as $term) {
1794                $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) );
1795                do_action( 'edit_term_taxonomy', $term );
1796                $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
1797                do_action( 'edited_term_taxonomy', $term );
1798           }
1799
1800      }
1801
1802      clean_term_cache($terms);
1803
1804      return true;
1805 }
1806
 
Line Code
2172  * @param array $terms List of Term taxonomy IDs
2173  */
2174 function _update_post_term_count( $terms ) {
2175      global $wpdb;
2176
2177      foreach ( (array) $terms as $term ) {
2178           $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 ) );
2179           do_action( 'edit_term_taxonomy', $term );
2180           $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
2181           do_action( 'edited_term_taxonomy', $term );
2182      }
2183 }
2184
2185
2186 /**
2187  * Generates a permalink for a taxonomy term archive.
2188  *
2189  * @since 2.5.0
2190  *