Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#36315 closed defect (bug) (duplicate)

get_avatar_data filter hook runs twice per request

Reported by: henrywright's profile henry.wright Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.2
Component: Users Keywords:
Focuses: Cc:


If you run this test function hooked to get_avatar_data, you should see $var gets dumped twice:

add_filter( 'get_avatar_data', function( $args, $id_or_email ) {
    $var = 'foo';
    var_dump( $var );
    return $args;
}, 10, 2 );

Change History (3)

#1 @SergeyBiryukov
8 years ago

  • Component changed from General to Users

It's intentional, see the discussion in #32572.

#2 @henry.wright
8 years ago

On pages with lots of avatars, wp-admin/users.php for example, this filter will already be running ~10 times, so increasing that figure to ~20 unnecessarily seems inefficient?

Last edited 8 years ago by henry.wright (previous) (diff)

#3 @rachelbaker
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version changed from 4.4.2 to 4.2

As noted in #32572 this is intentional behavior and the performance impact is negligible.

Note: See TracTickets for help on using tickets.