Skip to content

Commit c575bbb

Browse files
committed
code quality: ensure get_the_author_posts() returns int
1 parent 8b65593 commit c575bbb

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/wp-includes/author-template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function get_the_author_posts() {
286286
if ( ! $post ) {
287287
return 0;
288288
}
289-
return count_user_posts( $post->post_author, $post->post_type );
289+
return (int) count_user_posts( $post->post_author, $post->post_type );
290290
}
291291

292292
/**

src/wp-includes/user.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ function count_user_posts( $userid, $post_type = 'post', $public_only = false )
637637
* @since 4.1.0 Added `$post_type` argument.
638638
* @since 4.3.1 Added `$public_only` argument.
639639
*
640-
* @param int $count The user's post count.
640+
* @param string $count The user's post count. This is a numeric-string for legacy reasons.
641641
* @param int $userid User ID.
642642
* @param string|array $post_type Single post type or array of post types to count the number of posts for.
643643
* @param bool $public_only Whether to limit counted posts to public posts.

0 commit comments

Comments
 (0)