From e90ae0625d72aded2354833e70a964c3f103f346 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Sun, 6 Oct 2024 09:48:28 +0200 Subject: [PATCH] Fix post count on friends-list --- includes/class-admin.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/class-admin.php b/includes/class-admin.php index 1fc71f7d..35fbac10 100644 --- a/includes/class-admin.php +++ b/includes/class-admin.php @@ -2687,8 +2687,14 @@ public static function user_list_custom_column( $output, $column_name, $user_id if ( 'friends_posts' !== $column_name ) { return $output; } - $numposts = count_user_posts( $user_id, apply_filters( 'friends_frontend_post_types', array( 'post' ) ) ); $user = User::get_user_by_id( $user_id ); + if ( ! $user ) { + return $output; + } + + $post_status_counts = $user->get_post_count_by_post_format(); + $numposts = array_sum( $post_status_counts ); + return sprintf( '%s', $user ? $user->get_local_friends_page_url() : "edit.php?author={$user_id}",