WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#36385 closed feature request (invalid)

Request: Allow Gravatar's "d" param to be filtered

Reported by: henry.wright Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4.2
Component: Users Keywords:
Focuses: Cc:
PR Number:

Description

Inside get_avatar_data() the d param is set like this:

$url_args = array(
    's' => $args['size'],
    'd' => $args['default'],
    'f' => $args['force_default'] ? 'y' : false,
    'r' => $args['rating'],
);

Here, $args['default'] will be something like mm or wavatar etc. These are the "default" default images generated and then served up by Gravatar. However, Gravatar also allows d to be a custom URL. Let's call this a "custom" default image.

Ref: https://en.gravatar.com/site/implement/images/#default-image

Is it possible to add a filter so that we can filter the value of d?

Change History (5)

#1 @SergeyBiryukov
4 years ago

  • Component changed from General to Users

#2 @SergeyBiryukov
4 years ago

You can filter all the arguments, including $args['default'], using the get_avatar_data filter.

Last edited 4 years ago by SergeyBiryukov (previous) (diff)

#3 @SergeyBiryukov
4 years ago

Correction: get_avatar_data probably won't work for this use case, as it runs after the URL is constructed.

pre_get_avatar_data should work.

#4 @henry.wright
4 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Thanks @SergeyBiryukov for pointing out pre_get_avatar_data. I guess d is already filterable :D

I'll close this.

#5 @SergeyBiryukov
4 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.