why my custom gravatar not showing up on wordpress

Can you please anyone help me my custom gravatar not showing up on wordpress if i use plugin its working fine and one more thing i check it on loacalhost. Is it possible to not working in local. Below is my code.

// customize default gravatars

Read More
function custom_gravatars($avatar_defaults) {

    // add another custom gravatar
    $customGravatar3 = get_bloginfo('template_directory').'/images/default-avatar.jpg';
    $avatar_defaults[$customGravatar3] = 'Custom gravatar';

    return $avatar_defaults;
}
add_filter('avatar_defaults', 'custom_gravatars');

enter image description here
Please help me.

Related posts

1 comment

  1. You will need to install it before It shows up. Here are easy steps to proceed:

    1- Access your ftp > Go to Folder > wp-content > Themes > In this folder open up the theme folder you are currently using.

    2- Open up functions.php > Add the code bellow after the opening <?php

    Code:

    add_filter( 'avatar_defaults', 'newgravatar' );
    function newgravatar ($avatar_defaults) {
    $myavatar = get_bloginfo('template_directory') . '/custom-gravatar.gif';
    $avatar_defaults[$myavatar] = "You Name here or Website Name";
    return $avatar_defaults;
    }
    

    3- Upload your custom gravatar image “custom-gravatar.gif” to your theme directory.

    4- Finally, login to your WordPress Admin Panel and click on Settings > Discussion > Select your custom gravatar.

Comments are closed.