Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: edit_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
3389       * Fires immediate before a term-taxonomy relationship is updated.
3390       *
3391       * @since 2.9.0
3392       * @since 6.1.0 The `$args` parameter was added.
3393       *
3394       * @param int    $tt_id    Term taxonomy ID.
3395       * @param string $taxonomy Taxonomy slug.
3396       * @param array  $args     Arguments passed to wp_update_term().
3397       */
3398      do_action( 'edit_term_taxonomy', $tt_id, $taxonomy, $args );
3399
3400      $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) );
3401
3402      /**
3403       * Fires immediately after a term-taxonomy relationship is updated.
3404       *
3405       * @since 2.9.0
3406       * @since 6.1.0 The `$args` parameter was added.
3407       *
 
Line Code
4197            * @since 6.9.0
4198            *
4199            * @param int    $tt_id         Term taxonomy ID.
4200            * @param string $taxonomy_name Taxonomy slug.
4201            * @param int    $count         Term count.
4202            */
4203           do_action( 'update_term_count', $tt_id, $taxonomy->name, $count );
4204
4205           /** This action is documented in wp-includes/taxonomy.php */
4206           do_action( 'edit_term_taxonomy', $tt_id, $taxonomy->name );
4207           $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $tt_id ) );
4208
4209           /** This action is documented in wp-includes/taxonomy.php */
4210           do_action( 'edited_term_taxonomy', $tt_id, $taxonomy->name );
4211      }
4212 }
4213
4214 /**
4215  * Updates term count based on number of objects.
 
Line Code
4227      global $wpdb;
4228
4229      foreach ( (array) $terms as $term ) {
4230           $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term ) );
4231
4232           /** This action is documented in wp-includes/taxonomy.php */
4233           do_action( 'update_term_count', $term, $taxonomy->name, $count );
4234
4235           /** This action is documented in wp-includes/taxonomy.php */
4236           do_action( 'edit_term_taxonomy', $term, $taxonomy->name );
4237           $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
4238
4239           /** This action is documented in wp-includes/taxonomy.php */
4240           do_action( 'edited_term_taxonomy', $term, $taxonomy->name );
4241      }
4242 }
4243
4244 /**
4245  * Creates a new term for a term_taxonomy item that currently shares its term