WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#36315 closed defect (bug) (duplicate)

get_avatar_data filter hook runs twice per request

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

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

  • Component changed from General to Users

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

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

#3 @rachelbaker
3 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. https://core.trac.wordpress.org/ticket/32572#comment:23

Note: See TracTickets for help on using tickets.