else { // Email address.
$email =
$id_or_email;
} } elseif ( $id_or_email instanceof WP_User
) { // User object.
$user =
$id_or_email;
} elseif ( $id_or_email instanceof WP_Post
) { // Post object.
$user =
get_user_by( 'id',
(int) $id_or_email->post_author
);
} elseif ( $id_or_email instanceof WP_Comment
) { if ( !
is_avatar_comment_type( get_comment_type( $id_or_email ) ) ) { $args['url'
] = false;
/** This filter is documented in wp-includes/link-template.php */
return apply_filters( 'get_avatar_data',
$args,
$id_or_email );
} if ( !
empty( $id_or_email->user_id
) ) { $user =
get_user_by( 'id',
(int) $id_or_email->user_id
);
} if ( ( !
$user ||
is_wp_error( $user ) ) && !
empty( $id_or_email->comment_author_email
) ) { $email =
$id_or_email->comment_author_email;
} }