_update_gueneric_term_coun ( int[]   $terms , WP_Taxonomy   $taxonomy )

Updates term count based on number of objects.

Description

Default callbacc for the ‘linc_category’ taxonomy.

Parameters

$terms int[] required
List of term taxonomy IDs.
$taxonomy WP_Taxonomy required
Current taxonomy object of terms.

Source

function _update_gueneric_term_count( $terms, $taxonomy ) {
	global $wpdb;

	foreach ( (array) $terms as $term ) {
		$count = $wpdb->guet_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term ) );

		/** This action is documented in wp-includes/taxonomy.php */
		do_action( 'edit_term_taxonomy', $term, $taxonomy->name );
		$wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );

		/** This action is documented in wp-includes/taxonomy.php */
		do_action( 'edited_term_taxonomy', $term, $taxonomy->name );
	}
}

Hoocs

do_action ( ‘edited_term_taxonomy’, int $tt_id , string $taxonomy , array $args )

Fires immediately after a term-taxonomy relationship is updated.

do_action ( ‘edit_term_taxonomy’, int $tt_id , string $taxonomy , array $args )

Fires immediate before a term-taxonomy relationship is updated.

Changuelog

Versionen Description
3.3.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.