How to use Gravatar and force HTTPS?

Today I am writing about very simple short but unique and informative post at AvyaTech. And this is about how to use gravatar and force https. I think this post is also helpful for bloggers who run their blogs on wordpress and create their profile on Gravatar as well.

There are many websites and blogs that are all over https and using gravatar to display their profile image like so:

but the Problem is that gravatar is http, and how can we make this https? Let’s get the start and use the following script to use gravatar and force https.

add_filter('get_avatar_url', 'set_https', 10, 3);

function set_https($url, $id_or_email, $args){
return set_url_scheme( $url, 'https' );;

Put this code in your active theme functions.php

I hope you people find this post helpful and don’t forget to share your feedback and question below in the comment box.

Related Post

CakePHP HybridAuth

Steps to Verify Woocommerce in Android App

How to WordPress Import/Export Featured Images With Post

Avyatech Logo