Switch to a transient for is_multi_author(). props markjaquith, fixes #24445.

git-svn-id: http://core.svn.wordpress.org/trunk@24628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-07-10 04:20:41 +00:00
parent 8707375cee
commit 9f7ba7539c
1 changed files with 3 additions and 3 deletions

View File

@ -372,10 +372,10 @@ function wp_list_authors($args = '') {
function is_multi_author() {
global $wpdb;
if ( false === ( $is_multi_author = wp_cache_get('is_multi_author', 'posts') ) ) {
if ( false === ( $is_multi_author = get_transient( 'is_multi_author' ) ) ) {
$rows = (array) $wpdb->get_col("SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 2");
$is_multi_author = 1 < count( $rows ) ? 1 : 0;
wp_cache_set('is_multi_author', $is_multi_author, 'posts');
set_transient( 'is_multi_author', $is_multi_author );
}
return apply_filters( 'is_multi_author', (bool) $is_multi_author );
@ -387,6 +387,6 @@ function is_multi_author() {
* @private
*/
function __clear_multi_author_cache() {
wp_cache_delete('is_multi_author', 'posts');
delete_transient( 'is_multi_author' );
}
add_action('transition_post_status', '__clear_multi_author_cache');