Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#36315 closed defect (bug) (duplicate)

get_avatar_data filter hook runs twice per request

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

Description

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
11 years ago

  • Component General → Users

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

#2 @henry.wright
11 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 11 years ago by henry.wright (previous) (diff)

#3 @rachelbaker
10 years ago

  • Milestone Awaiting Review
  • Resolution → duplicate
  • Status new → closed
  • Version 4.4.2 → 4.2

As noted in #32572 this is intentional behavior and the performance impact is negligible. https://core.trac.wordpress.org/ticket/32572#comment:23

Note: See TracTickets for help on using tickets.