0

I added the following code to the functions.php file

add_filter( 'avatar_defaults', 'new_gravatar' );

function new_gravatar ($avatar_defaults) {
    $myavatar = 'link';
    $avatar_defaults[$myavatar] = "name";
    return $avatar_defaults;

I'm taking the profile picture from my own server. But there is a problem!

"I1.wp.com" appears at the beginning of the url in the profile image. What is the reason? So it looks like: "https://i1.wp.com/mysite.com/images/myavatar.png"

I've disabled all plugins. But the result was not successful.

I'm dealing with it in days. How do we delete wp.com at the beginning of Url?

  • is jetpack plugin active? – Latheesh V M Villa Sep 28 '18 at 17:25
  • No. Not loaded. I don't use jetpack anyway. *It seems to me that it's about wordpress files. – A. Muller Sep 28 '18 at 19:39
  • not sure how it can be solved..but i have also noticed the same thought it was jetpack – Latheesh V M Villa Sep 28 '18 at 20:02
  • The jetpack is definitely not even loaded. I've never used it. But this problem only happens in the author's profile pictures. (There is no such problem in other pictures) I've also disabled all add-ons. (The cache has been cleared.) Probably, wordpress is related to system files. But I'm looking for this file. – A. Muller Sep 28 '18 at 20:07
0

I found the answer to your question.

I've created a simple avatar plugin. (I edited and developed the code)

if ( !function_exists( 'get_avatar' ) ) :
    function get_avatar( $id_or_email, $size = '0', $default = '', $alt = false ) {
    if ( ! get_option('show_avatars') )
        return false;
    static $default_url;
    if ( !isset( $default_url ) )  $default_url = 'http://example.com/image/my-image.png' ;
    if ( false === $alt)
        $safe_alt = '';
    else
        $safe_alt = esc_attr( $alt );
    if ( !is_numeric( $size ) )
        $size = '0';
    $avatar = "<img alt='{$safe_alt}' src='{$default_url}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
    return apply_filters( 'get_avatar', $avatar, $id_or_email, $size, $default, $alt );
}
endif;
function __limit_default_avatars_setting( $default )
{
}
add_filter( 'avatar_defaults', '__limit_default_avatars' );


?>

I chose to take the image directly from the directory.

get_template_directory_uri()

instead

$default_url =

it was logical to use this code. because the other is redirecting to wordpress cdn url. (just like in emoji and svg profiles)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.