Action hook 'edit_term_taxonomy'

in WP Core File wp-includes/taxonomy.php at line 4214

View Source

edit_term_taxonomy

Action Hook
Description
Updates term count based on number of objects. Default callback for the 'link_category' taxonomy.

Hook Information

File Location wp-includes/taxonomy.php View on GitHub
Hook Type Action
Line Number 4214

Hook Parameters

Type Name Description
int[] $terms List of term taxonomy IDs.
WP_Taxonomy $taxonomy Current taxonomy object of terms.

Usage Examples

Basic Usage
<?php
// Hook into edit_term_taxonomy
add_action('edit_term_taxonomy', 'my_custom_function', 10, 2);

function my_custom_function($terms, $taxonomy) {
    // Your custom code here
}

Source Code Context

wp-includes/taxonomy.php:4214 - How this hook is used in WordPress core
<?php
4209  
4210  	foreach ( (array) $terms as $term ) {
4211  		$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term ) );
4212  
4213  		/** This action is documented in wp-includes/taxonomy.php */
4214  		do_action( 'edit_term_taxonomy', $term, $taxonomy->name );
4215  		$wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
4216  
4217  		/** This action is documented in wp-includes/taxonomy.php */
4218  		do_action( 'edited_term_taxonomy', $term, $taxonomy->name );
4219  	}

PHP Documentation

<?php
/**
 * Updates term count based on number of objects.
 *
 * Default callback for the 'link_category' taxonomy.
 *
 * @since 3.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int[]       $terms    List of term taxonomy IDs.
 * @param WP_Taxonomy $taxonomy Current taxonomy object of terms.
 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-includes/taxonomy.php
Related Hooks

Related hooks will be displayed here in future updates.