How to Change the Default Gravatar With Your Custom Image on WordPress
- Article
- Comment
Introduction
How to Change the Default Gravatar With Your Custom Image on WordPress? Especially, on some works we , feel to use our custom default image as default gravatar for it. And I was specially used the same thing for this article, you can see here with the following example.
Here is a small piece of code enclosed with a custom function to hook it. Once you add this code on your theme `functions.php` or your plugins `main-file`. It will be hooked, than you have to upload your gravatar on to the images directory `themes/your-theme/images/kv-gravatar.png`.
// Default Gravatar Logo change.. function kv_new_gravatar ($avatar_defaults) { $kv_default_logo = get_bloginfo('template_directory') . '/images/kv-gravatar.png'; $avatar_defaults[$kv_default_logo] = "Kvcodes Blue"; return $avatar_defaults; } add_filter( 'avatar_defaults', 'kv_new_gravatar' );
Here is some screenshots, how it looks like when you have implemented.
Now, you have to login to the backend and goto the `Settings->Discussion`. And, you can see your custom logo at the last of the gravatars list. you can pick. Than , it will be the default one on your website always.
If you are interested to read more about WordPress Development Subscribe me my newsletters to get more tutorials and tips from kvcodes.com and also you can follow me through social sites, which also available in the below space.