REST API: Allow rest_get_avatar_urls() to accept full user, post, or comment objects, rather than just an email address, to provide better flexibility for alternative avatar data.
Since the function uses `get_avatar_url()` internally, which already supports it, this should not have any backward compatibility concerns. Props donmhico, dshanske, pputzer, joehoyle, TimothyBlynJacobs. Fixes #40030. Built from https://develop.svn.wordpress.org/trunk@45632 git-svn-id: http://core.svn.wordpress.org/trunk@45443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -949,7 +949,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
||||
}
|
||||
|
||||
if ( in_array( 'author_avatar_urls', $fields, true ) ) {
|
||||
$data['author_avatar_urls'] = rest_get_avatar_urls( $comment->comment_author_email );
|
||||
$data['author_avatar_urls'] = rest_get_avatar_urls( $comment );
|
||||
}
|
||||
|
||||
if ( in_array( 'meta', $fields, true ) ) {
|
||||
|
||||
Reference in New Issue
Block a user