The is_multi_author WordPress PHP Filter checks if the site has more than one author with published posts.
Usage
add_filter('is_multi_author', 'my_custom_is_multi_author'); function my_custom_is_multi_author($is_multi_author) { // your custom code here return $is_multi_author; }
Parameters
$is_multi_author bool
: Determines whether the site has multiple authors with published posts.
More information
See WordPress Developer Resources: is_multi_author
Examples
Force single author status
Force the site to be considered as having only one author, regardless of the actual number of authors with published posts.
add_filter('is_multi_author', 'force_single_author_status'); function force_single_author_status($is_multi_author) { return false; }
Check for specific author count
Modify the filter to check if the site has at least three authors with published posts.
add_filter('is_multi_author', 'check_three_authors'); function check_three_authors($is_multi_author) { global $wpdb; $author_count = (int) $wpdb->get_var("SELECT COUNT(DISTINCT post_author) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'"); return $author_count >= 3; }
Ignore certain authors
Ignore specific authors when determining if the site has multiple authors with published posts.
add_filter('is_multi_author', 'ignore_certain_authors'); function ignore_certain_authors($is_multi_author) { global $wpdb; $ignored_authors = array(3, 7, 10); // Change the array to the author IDs you want to ignore $author_count = (int) $wpdb->get_var("SELECT COUNT(DISTINCT post_author) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' AND post_author NOT IN (" . implode(',', $ignored_authors) . ")"); return $author_count > 1; }
Count only authors with a minimum post count
Determine if the site has multiple authors with at least a specified number of published posts.
add_filter('is_multi_author', 'min_post_count_authors'); function min_post_count_authors($is_multi_author) { global $wpdb; $min_post_count = 5; // Change this to the minimum number of posts required $author_count = (int) $wpdb->get_var("SELECT COUNT(*) FROM (SELECT post_author FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY post_author HAVING COUNT(*) >= $min_post_count) as author_count"); return $author_count > 1; }
Check for custom post types
Modify the filter to check for multiple authors with published posts in a custom post type.
add_filter('is_multi_author', 'check_custom_post_type_authors'); function check_custom_post_type_authors($is_multi_author) { global $wpdb; $custom_post_type = 'my_custom_post_type'; // Change this to your custom post type $author_count = (int) $wpdb->get_var("SELECT COUNT(DISTINCT post_author) FROM $wpdb->posts WHERE post_type = '$custom_post_type' AND post_status = 'publish'"); return $author_count > 1; }