| | 366 | /** |
| | 367 | * Does this site have more than one author |
| | 368 | * |
| | 369 | * Checks to see if more than one author has published posts. |
| | 370 | * |
| | 371 | * @return bool Whether or not we have more than one author |
| | 372 | */ |
| | 373 | function is_multi_author() { |
| | 374 | global $wpdb; |
| | 375 | |
| | 376 | if ( false === ( $is_multi_author = wp_cache_get('is_multi_author', 'posts') ) ) { |
| | 377 | $rows = (array) $wpdb->get_col("SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 2"); |
| | 378 | $is_multi_author = 1 < count( $rows ) ? 1 : 0; |
| | 379 | wp_cache_set('is_multi_author', $is_multi_author, 'posts'); |
| | 380 | } |
| | 381 | |
| | 382 | return (bool) $is_multi_author; |
| | 383 | } |
| | 384 | |
| | 385 | /** |
| | 386 | * Helper function to clear the cache for number of authors. |
| | 387 | * |
| | 388 | * @private |
| | 389 | */ |
| | 390 | function __clear_multi_author_cache() { |
| | 391 | wp_cache_delete('is_multi_author', 'posts'); |
| | 392 | } |
| | 393 | add_action('transition_post_status', '__clear_multi_author_cache'); |
| | 394 | |