On this page
get_the_author_posts(): int
Retrieves the number of posts by the author of the current post.
Return
int The number of posts by the author.
Source
File: wp-includes/author-template.php. View all references
function get_the_author_posts() {
$post = get_post();
if ( ! $post ) {
return 0;
}
return count_user_posts( $post->post_author, $post->post_type );
}
Related
Uses
| Uses | Description |
|---|---|
| count_user_posts() wp-includes/user.php | Gets the number of posts a user has written. |
| get_post() wp-includes/post.php | Retrieves post data given a post ID or post object. |
Used By
| Used By | Description |
|---|---|
| the_author_posts() wp-includes/author-template.php | Displays the number of posts by the author of the current post. |
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_the_author_posts