Description Description

Runs an UPDATE query that updates term counts. Runs daily in a WordPress cron job.

I can't reproduce a phenomenon we're seeing on some dealer sites where term counts are not decremented after vehicles are deleted, so this is a band-aid that fixes term counts.

Top ↑

Return Return


Top ↑

Source Source

File: includes/class-taxonomies.php

	function update_term_counts()
		global $wpdb;
			"UPDATE		$wpdb->term_taxonomy tt

			SET			count = ( 
				SELECT		count( p.ID )
				FROM		$wpdb->term_relationships tr
							LEFT JOIN $wpdb->posts p ON p.ID = tr.object_id

				WHERE		tr.term_taxonomy_id = tt.term_taxonomy_id