Changeset 6376 for trunk/wp-includes/taxonomy.php
- Timestamp:
- 12/12/2007 05:14:00 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/taxonomy.php
r6364 r6376 1318 1318 } 1319 1319 1320 // enable or disable term count deferring 1321 // if no value is supplied, the current value of the defer setting is returned 1322 function wp_defer_term_counting($defer=NULL) { 1323 static $_defer = false; 1324 1325 if ( is_bool($defer) ) { 1326 $_defer = $defer; 1327 // flush any deferred counts 1328 if ( !$defer ) 1329 wp_update_term_count( NULL, NULL, true ); 1330 } 1331 1332 return $_defer; 1333 } 1334 1320 1335 /** 1321 1336 * wp_update_term_count() - Updates the amount of terms in taxonomy … … 1335 1350 * @return bool If no terms will return false, and if successful will return true. 1336 1351 */ 1337 function wp_update_term_count( $terms, $taxonomy ) { 1338 global $wpdb; 1352 function wp_update_term_count( $terms, $taxonomy, $do_deferred=false ) { 1353 static $_deferred = array(); 1354 1355 if ( $do_deferred ) { 1356 foreach ( array_keys($_deferred) as $tax ) { 1357 wp_update_term_count_now( $_deferred[$tax], $tax ); 1358 unset( $_deferred[$tax] ); 1359 } 1360 } 1339 1361 1340 1362 if ( empty($terms) ) … … 1343 1365 if ( !is_array($terms) ) 1344 1366 $terms = array($terms); 1367 1368 if ( wp_defer_term_counting() ) { 1369 if ( !isset($_deferred[$taxonomy]) ) 1370 $_deferred[$taxonomy] = array(); 1371 $_deferred[$taxonomy] = array_unique( array_merge($_deferred[$taxonomy], $terms) ); 1372 return true; 1373 } 1374 1375 return wp_update_term_count_now( $terms, $taxonomy ); 1376 } 1377 1378 function wp_update_term_count_now( $terms, $taxonomy ) { 1379 global $wpdb; 1345 1380 1346 1381 $terms = array_map('intval', $terms);
Note: See TracChangeset
for help on using the changeset viewer.