is_multi_author

Does this site have more than one author.

Description

is_multi_author(); 

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


Usage

  1. if ( !function_exists( 'is_multi_author' ) ) { 
  2. require_once ABSPATH . WPINC . '/author-template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = is_multi_author(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/author-template.php  
  1. function is_multi_author() { 
  2. global $wpdb; 
  3.  
  4. if ( false === ( $is_multi_author = get_transient( 'is_multi_author' ) ) ) { 
  5. $rows = (array) $wpdb->get_col("SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 2"); 
  6. $is_multi_author = 1 < count( $rows ) ? 1 : 0; 
  7. set_transient( 'is_multi_author', $is_multi_author ); 
  8.  
  9. /** 
  10. * Filters whether the site has more than one author with published posts. 
  11. * @since 3.2.0 
  12. * @param bool $is_multi_author Whether $is_multi_author should evaluate as true. 
  13. */ 
  14. return apply_filters( 'is_multi_author', (bool) $is_multi_author );