Remove i1.wp.com/ from default avatar link

Hi, I using an external link with Add New Default Avatar plugin that displays i1.wp.com/defaultavatarlink.com, instead of defaultavatarlink.com

any suggestions on removing unnecessary i1.wp.com/ ? it slows down loading of site. below is php code for plugin.

http://trepmal.com/plugins/add-new-default-avatar/

  • Alexander
    • DEV MAN’s Mascot

    Hey @buddha,

    I removed all that code, as there's really no reason to post an entire plugin's code. Just a link would be ok.

    I'm not sure what would cause that, but that plugin is only tested as far as 3.5.2 If you read the comments on it's site, you can see people complaining about things not working correctly. It seems the project might be abandoned, as they haven't responded to any recent support issues here: http://wordpress.org/plugins/add-new-default-avatar/

    Now, rather than using a plugin, the Codex suggests a quick way to do this with some custom code. You can take a look here: http://codex.wordpress.org/How_to_Use_Gravatars_in_WordPress#Create_a_Custom_Default_Avatar

    If you wanted a version that pulled an image from your media library, you could try something like this:

    add_filter( 'avatar_defaults', 'new_default_avatar' );
    
    function new_default_avatar ( $avatar_defaults ) {
    
            $image = wp_get_attachment_image_src( 123 );
            $avatar_defaults[$image[0]] = 'New Default Avatar';
            return $avatar_defaults;
    }

    Then replace 123 with the ID of the media attachement to use.

    Best regards,

  • buddha
    • Syntax Hero

    thanks, that worked great! - only adjustment needed was to remove "<?php" when adding to bottom of child theme's functions.php

    another helpful hint is to hover over image file name in media library to see post # to replace "123" in code above

    then go to Settings, Discussion, and choose new default avatar

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.