In WordPress, is_multi_author() returns true when more than one user has published a post on the site. If only one person writes posts, it returns false.
Themes use it to hide the author name on a one-author blog, and to show it on a team blog.
Syntax
Use it as the test of an if statement.
WordPress
if ( is_multi_author() ) {
// code for the true path
} else {
// code for the false path
}
Call
What it does
is_multi_author()
True if two or more authors have published posts.
! is_multi_author()
True on a one-author site.
the_author()
Prints the author name inside the loop.
WordPress saves the result for a short time, so the check is fast.
Full declaration
WordPress
is_multi_author(): bool
Parameters
Parameter
Description
None
This function takes no parameters.
Return Value
Return Value
Description
bool
true if more than one author has published posts, otherwise false.
WordPress Examples
Three short theme examples. Each one shows what prints on the true path and the false path.
Example 1 — Show a byline on team blogs
Print the author name only if there is more than one author.