Changeset 17901 for trunk/wp-includes/author-template.php
- Timestamp:
- 05/12/2011 07:14:44 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/author-template.php
r17548 r17901 369 369 } 370 370 371 /** 372 * Does this site have more than one author 373 * 374 * Checks to see if more than one author has published posts. 375 * 376 * @since 3.2 377 * @return bool Whether or not we have more than one author 378 */ 379 function is_multi_author() { 380 global $wpdb; 381 382 if ( false === ( $is_multi_author = wp_cache_get('is_multi_author', 'posts') ) ) { 383 $rows = (array) $wpdb->get_col("SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 2"); 384 $is_multi_author = 1 < count( $rows ) ? 1 : 0; 385 wp_cache_set('is_multi_author', $is_multi_author, 'posts'); 386 } 387 388 return (bool) $is_multi_author; 389 } 390 391 /** 392 * Helper function to clear the cache for number of authors. 393 * 394 * @private 395 */ 396 function __clear_multi_author_cache() { 397 wp_cache_delete('is_multi_author', 'posts'); 398 } 399 add_action('transition_post_status', '__clear_multi_author_cache'); 400 371 401 ?>
Note: See TracChangeset
for help on using the changeset viewer.