WordPress at a glance

is_multi_author() WP 1.0

Does this site have more than one author

Checks to see if more than one author has published posts.

  • Global. wpdb. $wpdb WordPress database abstraction object.
Hooks from function:
Return

true/false. Whether or not we have more than one author

Usage

is_multi_author();

Code of is_multi_author: wp-includes/author-template.php VER 4.9.8

<?php
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 );
	}

	/**
	 * 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 );
}

Related Functions

From tag: Conditional tags (all)

More from category: Other Theme Functions

No comments
    Hello, !     Log In . Register