wp_update_term_count_now

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

Perform term count update immediately.

Parameters

  • array $terms: The term_taxonomy_id of terms to update.
  • string $taxonomy: The context of the term.

Return values

returns:Always true when complete.

Source code

function wp_update_term_count_now( $terms, $taxonomy ) {

	global $wpdb;



	$terms = array_map('intval', $terms);



	$taxonomy = get_taxonomy($taxonomy);

	if ( !empty($taxonomy->update_count_callback) ) {

		call_user_func($taxonomy->update_count_callback, $terms, $taxonomy);

	} else {

		$object_types = (array) $taxonomy->object_type;

		foreach ( $object_types as &$object_type ) {

			if ( 0 === strpos( $object_type, 'attachment:' ) )

				list( $object_type ) = explode( ':', $object_type );

		}



		if ( $object_types == array_filter( $object_types, 'post_type_exists' ) ) {

			// Only post types are attached to this taxonomy

			_update_post_term_count( $terms, $taxonomy );

		} else {

			// Default count updater

			_update_generic_term_count( $terms, $taxonomy );

		}

	}



	clean_term_cache($terms, '', false);



	return true;

}

4239

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: