Quantcast
Viewing latest article 10
Browse Latest Browse All 10

_update_generic_term_count

Definition:
function _update_generic_term_count( $terms, $taxonomy ) {}

Will update term count based on number of objects.
Default callback for the link_category taxonomy.

Parameters

  • array $terms: List of Term taxonomy IDs
  • object $taxonomy: Current taxonomy object of terms

Defined actions

  • edit_term_taxonomy
    do_action( 'edit_term_taxonomy', $term, $taxonomy );
  • edited_term_taxonomy
    do_action( 'edited_term_taxonomy', $term, $taxonomy );

Source code

function _update_generic_term_count( $terms, $taxonomy ) {

	global $wpdb;



	foreach ( (array) $terms as $term ) {

		$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term ) );



		do_action( 'edit_term_taxonomy', $term, $taxonomy );

		$wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );

		do_action( 'edited_term_taxonomy', $term, $taxonomy );

	}

}

17988


Filed under: /wp-includes/taxonomy.php, Actions, Actions by letter e, Documentation, Files, Functions, _ Tagged: edited_term_taxonomy, edit_term_taxonomy, id551c132f62daca50ef77ccf890239c98, _update_generic_term_count Image may be NSFW.
Clik here to view.

Viewing latest article 10
Browse Latest Browse All 10

Trending Articles