use gravatar to force https

Today I am writing about a 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.

Author: Chandan Kumar

Tags: , ,

Recent Posts

Categories

Tags

4 responses to “How to use Gravatar and force HTTPS?

  1. Atul Host December 10, 2017 at 4:52 pm

    Awesome work man. For a secure website, it is required to load everything on https to avoid the mixed content issue.

  2. suresh lukhi December 20, 2017 at 12:19 pm

    This article important and really good the for me is.Amazing write-up, Great article. Thanks!

    1. Chandan Kumar December 20, 2017 at 12:23 pm

      Thank You, Suresh to visit on my Blog post.

Leave a Reply

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