How to Change the Default Gravatar With Your Custom Image on WordPress |
X

Congrats, You are Subscribed to Receive Updates.

How to Change the Default Gravatar With Your Custom Image on WordPress


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.

custom-gravatar image

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.

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, PHP and Data Analyst. Database Management Advance Level

Comment Below

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar