is_multi_author()

最后更新于:2021-11-27 09:10:05

is_multi_author()

Determines whether this site has more than one author.

响应

(bool) Whether or not we have more than one author

源文件

文件: gc-includes/author-template.php

function is_multi_author() {
	global $gcdb;

	$is_multi_author = get_transient( 'is_multi_author' );
	if ( false === $is_multi_author ) {
		$rows            = (array) $gcdb->get_col( "SELECT DISTINCT post_author FROM $gcdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 2" );
		$is_multi_author = 1 < count( $rows ) ? 1 : 0;
		set_transient( 'is_multi_author', $is_multi_author );
	}

	/**
	 * Filters whether the site has more than one author with published posts.
	 *
	 * @since 3.2.0
	 *
	 * @param bool $is_multi_author Whether $is_multi_author should evaluate as true.
	 */
	return apply_filters( 'is_multi_author', (bool) $is_multi_author );
}