is_multi_author()判断博客是否有超过一个作者发表过文章

目录

描述

This Conditional Tag checks if more than one author has published posts for this site, meaning it returns either TRUE if there is more than one author or FALSE if there is one, or no, authors.

is_multi_author() 描述

用法

<?php is_multi_author(); ?>

is_multi_author() 用法

参数

This tag does not accept any parameters.

is_multi_author() 参数

返回值

(boolean) 

True when two or more authors have published post, false on failure in one or no authors.

is_multi_author() 返回值

历史

  • 添加于 版本: 3.2

is_multi_author() 历史

源文件

is_multi_author() 函数的代码位于 wp-includes/author-template.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Does this site have more than one author
 *
 * Checks to see if more than one author has published posts.
 *
 * @since 3.2.0
 *
 * @global wpdb $wpdb
 *
 * @return bool Whether or not we have more than one author
 */
function is_multi_author() {
	global $wpdb;

	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;="" set_transient(="" 'is_multi_author',="" $is_multi_author="" );="" }="" *="" *="" filter="" 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="" );="" }="">

is_multi_author() 源文件

相关