diff --git a/co-authors-plus.php b/co-authors-plus.php index 2daeb4a6..4bd565b0 100644 --- a/co-authors-plus.php +++ b/co-authors-plus.php @@ -963,8 +963,15 @@ function filter_count_user_posts( $count, $user_id ) { $user = $this->get_coauthor_by( 'user_nicename', $user->user_nicename ); $term = $this->get_author_term( $user ); - // Only modify the count if the author already exists as a term - if ( $term && ! is_wp_error( $term ) ) { + $guest_term = get_term_by( 'slug', 'cap-' . $user->user_nicename, $this->coauthor_taxonomy ); + // Only modify the count if it has a linked account with posts or the author exists as a term + if ( $user->linked_account && $guest_term->count ) { + if ( $term && ! is_wp_error( $term )) { + $count = $guest_term->count + $term->count; + } else { + $count = $guest_term->count; + } + } elseif ( $term && ! is_wp_error( $term ) ) { $count = $term->count; } diff --git a/php/class-coauthors-wp-list-table.php b/php/class-coauthors-wp-list-table.php index 497fe623..a1f5046b 100644 --- a/php/class-coauthors-wp-list-table.php +++ b/php/class-coauthors-wp-list-table.php @@ -251,7 +251,10 @@ function column_linked_account( $item ) { function column_posts( $item ) { global $coauthors_plus; $term = $coauthors_plus->get_author_term( $item ); - if ( $term ) { + $guest_term = get_term_by( 'slug', 'cap-' . $item->user_nicename, $coauthors_plus->coauthor_taxonomy ); + if ( ! empty( $item->linked_account ) && $guest_term->count ) { + $count = count_user_posts( get_user_by( 'slug', $item->linked_account )->ID ); + } elseif ( $term ) { $count = $term->count; } else { $count = 0;