diff --git a/co-authors-plus.php b/co-authors-plus.php
index f3d6f0d0..948d3b3a 100755
--- a/co-authors-plus.php
+++ b/co-authors-plus.php
@@ -446,7 +446,11 @@ public function coauthors_meta_box( $post ) {
ID );
+ $user_type = 'guest-user';
+ if ( $coauthor instanceof WP_User ) {
+ $user_type = 'wp-user';
+ }
+ $avatar_url = get_avatar_url( $coauthor->ID, array( 'user_type' => $user_type ) );
?>
ID, $this->gravatar_size ); ?>
@@ -1833,9 +1837,29 @@ public function get_guest_author_post_count( $guest_author ) {
* @return string Avatar URL
*/
public function filter_pre_get_avatar_data_url( $args, $id ) {
+ global $wp_current_filter;
+
if ( ! $id || ! $this->is_guest_authors_enabled() || ! is_numeric( $id ) || isset( $args['url'] ) ) {
return $args;
}
+
+ // Do not filter the icon in the admin bar
+ if ( doing_filter( 'admin_bar_menu' ) ) {
+ return $args;
+ }
+
+ // Do not filter when we have a WordPress user sent from CAP meta box
+ if ( isset( $args['user_type'] ) && 'wp-user' === $args['user_type'] ) {
+ return $args;
+ }
+
+ // Do not filter when on the user screen
+ $current_screen = get_current_screen();
+ if ( isset( $current_screen->parent_base ) && 'users' == $current_screen->parent_base ) {
+ return $args;
+ }
+
+
$coauthor = $this->get_coauthor_by( 'id', $id );
if ( false !== $coauthor && isset( $coauthor->type ) && 'guest-author' === $coauthor->type ) {
if ( has_post_thumbnail( $id ) ) {