• I don’t use avatars on my WordPress sites and have unchecked “Show Avatars” in the Discussion Settings section of the dashboard. However, I notice that the Default Avatars section of that page continues to call secure.gravatar.com even with that option turned off:

    <td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span>Default Avatar</span></legend>
    
    For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their email address.<br />
    
    	<label><input type='radio' name='avatar_default' id='avatar_mystery' value='mystery' checked="checked" /> <img alt='' src='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=32&d=mm&f=y&r=g' srcset='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=64&d=mm&f=y&r=g 2x' class='avatar avatar-32 photo avatar-default' height='32' width='32' /> Mystery Person</label><br />
    	<label><input type='radio' name='avatar_default' id='avatar_blank' value='blank' /> <img alt='' src='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=32&d=blank&f=y&r=g' srcset='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=64&d=blank&f=y&r=g 2x' class='avatar avatar-32 photo avatar-default' height='32' width='32' /> Blank</label><br />
    	<label><input type='radio' name='avatar_default' id='avatar_gravatar_default' value='gravatar_default' /> <img alt='' src='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=32&f=y&r=g' srcset='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=64&f=y&r=g 2x' class='avatar avatar-32 photo avatar-default' height='32' width='32' /> Gravatar Logo</label><br />
    	<label><input type='radio' name='avatar_default' id='avatar_identicon' value='identicon' /> <img alt='' src='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=32&d=identicon&f=y&r=g' srcset='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=64&d=identicon&f=y&r=g 2x' class='avatar avatar-32 photo avatar-default' height='32' width='32' /> Identicon (Generated)</label><br />
    	<label><input type='radio' name='avatar_default' id='avatar_wavatar' value='wavatar' /> <img alt='' src='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=32&d=wavatar&f=y&r=g' srcset='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=64&d=wavatar&f=y&r=g 2x' class='avatar avatar-32 photo avatar-default' height='32' width='32' /> Wavatar (Generated)</label><br />
    	<label><input type='radio' name='avatar_default' id='avatar_monsterid' value='monsterid' /> <img alt='' src='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=32&d=monsterid&f=y&r=g' srcset='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=64&d=monsterid&f=y&r=g 2x' class='avatar avatar-32 photo avatar-default' height='32' width='32' /> MonsterID (Generated)</label><br />
    	<label><input type='radio' name='avatar_default' id='avatar_retro' value='retro' /> <img alt='' src='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=32&d=retro&f=y&r=g' srcset='https://secure.gravatar.com/avatar/32494f5a00b1b12677f3b3d6bbef7fe5?s=64&d=retro&f=y&r=g 2x' class='avatar avatar-32 photo avatar-default' height='32' width='32' /> Retro (Generated)</label><br />
    </fieldset></td>

    Is there a way to completely prevent Gravatar server calls without modifying the core files? I imagine it should be possible to remove that cell, or replace the IMG SRC attributes with nothing, using a function or functions, but that’s beyond my technical knowledge.

Viewing 11 replies - 1 through 11 (of 11 total)
  • I saw this recently in core ticket https://core.trac.www.ads-software.com/ticket/43799
    which also mentions that it is a duplicate of https://core.trac.www.ads-software.com/ticket/14682

    Thread Starter Ate Up With Motor

    (@ate-up-with-motor)

    Yikes! That’s worse than I thought. (Those threads make certain I will never, ever enable avatar support.)

    However, those don’t address the specific issue I mentioned, which is that the Discussion settings screen is still calling images from secure.gravatar.com even with Show Avatars unchecked. Those calls are hidden, but they aren’t removed, so they still expose the IP address of unwary administrative users (and possibly their email address? I don’t know if just the icon call passes that data to Gravatar.)

    Dion

    (@diondesigns)

    The following code will remove the display of avatar defaults:

    add_filter( 'avatar_defaults', function($junk){return array();} );
    add_filter( 'default_avatar_select', function($junk){return '';} );
    Thread Starter Ate Up With Motor

    (@ate-up-with-motor)

    Is the syntax of that right? I tried adding that to functions.php and it gave me the white screen of death.

    The syntax is good for only certain versions of PHP.

    add_filter( 'avatar_defaults', '__return_empty_array' );
    add_filter( 'default_avatar_select', '__return_empty_string' );

    See https://developer.www.ads-software.com/?s=__return

    Thread Starter Ate Up With Motor

    (@ate-up-with-motor)

    Joy,

    Does that work with PHP 7? The developer page doesn’t indicate.

    Thanks!

    Dion

    (@diondesigns)

    The code I provided requires PHP 5.3 or later because it uses anonymous functions. The code was successfully tested on a server using PHP 7.1.22. I do not use or recommend the functions built into WordPress for this purpose because they’re antiquated coding, and they set bad examples for people learning PHP. (This has been a problem with WordPress for years, but thankfully there is a big push to update the WP codebase to more modern PHP coding standards.)

    If the code I provided didn’t work on your site, my suggestion is to update your version of PHP since no one should be running a version of PHP that old.

    Thread Starter Ate Up With Motor

    (@ate-up-with-motor)

    I’m on the latest iteration of PHP 7.2 (7.2.27?), so I don’t think it’s that the PHP version is too old.

    Thread Starter Ate Up With Motor

    (@ate-up-with-motor)

    Excuse me, 7.2.7.

    All of WordPress is tested with PHP 5.2.4 through PHP 7.2.

    because they’re antiquated coding

    They are backward compatible and support the range of PHP versions listed. WordPress is 15 years old, and while it changes all the time, it tries not to break plugins and themes written before. It is not a bad example to follow.

    Thread Starter Ate Up With Motor

    (@ate-up-with-motor)

    I’m not a developer, so I’m not in a position to get into an argument about the merits of WordPress functions — my concern is whether something is going to work without breaking something else in the process. Again, I’m on PHP 7.2, so outdated PHP shouldn’t be an issue, but the functions Dion Designs suggests cause white screen of death.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Is it possible to completely remove Gravatar calls from dashboard?’ is closed to new replies.