How to quickly restore Facebook comments to your WordPress website after migration to SSL

Hello friends,

In today’s post I will share with you one quick and easy to apply fix for your “lost” Facebook comments after you’ve managed to move your website to SSL.

Before we begin – let’s define when this tutorial will be useful for you.

First of all you have to be using Facebook comments for your WordPress website. As you know from our previous posts on the topic, this is a great way to allow more people to get involved with your content without the need of additional registrations. Also each Facebook comment increases the popularity of your website within the social media.

For the purpose of this tutorial you may need to use the plugin “Facebook Comments”. Read more about it here: Facebook Comments for WordPress.

Second – this tutorial will be useful if you have just migrated from non-SSL to a SSL version of your WordPress website by using the “Really Simple SSL” plugin. Read how to achieve this from our post: Really Simple SSL – the proper way to secure WordPress.

Now let’s assume that you have been using Facebook Comments for a while before the migration to SSL. You have set up the plugin correctly and your visitors have commented on your website at least once and you are sure that the comments have been displayed correctly. Then you have decided to migrate to SSL and the comments are gone.

This is where our tutorial begins. Prepare to learn how to quickly restore Facebook comments to your WordPress website after migration to SSL!

Your Facebook comments are not lost! You can check them out in your moderation tool. They may have been disabled or hidden, but they are still there. Re-enable them if needed and then return to your WordPress website.

Create a child theme if you haven’t done this already. This will ensure that your Facebook comments won’t get lost again during your theme’s update. If you have set up your child theme successfully simply create a new functions.php file for it. This can be a blank file (i.e. without any content in it). Save it and then edit it.

Add the following code:

function rsssl_exclude_http_url($html) { 
//replace the https url back to http 
$html = str_replace('data-href="', 'data-href="', $html); 
return $html; 

Change to your website’s domain name (with or without www). Do this for both entries (http and https) in the code above. Save the file and clear your cache.

Reload the post or page where you were certain that you had Facebook comments before the migration to SSL. They should be back once again.

In case you are not using a child theme you can add this code to your main functions.php file and save it. However when your theme gets updated this code will be lost and you will need to re-enter it once again.

That’s all friends! For more information and other solutions for the “lost” Facebook comments after migrating to SSL for your WordPress website, please read this post: How to recover Facebook likes after moving to https/ssl.

If you have any questions or other feedback, please share them in the comment section below. See you soon, friends!

About Daniel Angelov

AvatarHi! My name is Daniel Angelov and I am a guest-author at TheCMSPlace. I am a certified SEO and Digital Marketing Specialist. My passion is WordPress, Social Media, Project Management, Open Source Software, Marketing, SEO and Copywriting. In my free time I like reading and fishing. My personal blog is ""

6 thoughts on “How to quickly restore Facebook comments to your WordPress website after migration to SSL”

  • Hi Daniel,
    I upgraded to SSL yesterday and lost all my FB comments on my site. I checked on my FB app, and they are surely all there. I also posted some new comments, and all the ones after SSL are showing up.

    The plugin you recommend here is no longer active. I tried a couple of other plugins, including ‘Fancy Facebook Comments’ , which has a checkbox to show pre-SSL FB comments, but it didn’t work. Even the developer spent some time digging around on my site trying to get it to work, and it would not.

    I’ve inserted the code you have above into functions.php in my theme (Twenty Fourteen) on my site. I tried at the top and the bottom and it didn’t work. Maybe I’m putting it in the wrong place??? I don’t know php at all (html is my limit).

    Yes, I deleted the website cache and cleared the browser cache each time. Also tried a different browser.

    The developer of the Fancy plugin says his plugin doesn’t require that code, as it’s already in the plugin, but that was little consolation as nothing has worked.

    I’ve tried deactivating the other plugins, etc. I even deactivated Super Cache. No joy at all.

    Do you have any ideas? I CAN see all the comments in my FB moderator page, so I know they’re ‘there’ in cyberspace.

    I’m feeling pretty bummed out by all this. Years of comments sitting in the ozone. 🙁

    I really hope you can help.

    • Hi. I was not aware that the FB Comments plugin was removed. Sadly that this plugin was removed as it was easy to use. Now on the topic at hand. The current post is for any issue with fb comments and ssl (if they are not displayed) and it should not bother with the linked plugin for fb comments. Also bear in mind that the current post is an old post – 2017. You should always try to find solutions as recent as the current year or the previous as things change dynamically. Nevertheless the code provided was based on a solution on either Really Simple SSL site or their wordpress plugin page. And for my sites it worked as expected. Unfortunately I am not a PHP developer – just a regular user. If you have used really simple ssl and the mentioned solution does not help you, I strongly advise you to discuss the issue with the creators of really simple ssl or their community on the WordPress plugin page. They should be able to provide solution.

    • Hi,
      For this solution to work you have to activate the really simple SSL plugin. It’s better to use this code here Navigate to the manual Way section and copy and paste the code into your functions.php. Insert it in the end of your functions.php.

  • Sadly, that is the exact code I have already tried, and it did nothing. 🙁

    Are you saying I don’t need a 3rd-party plugin to show the comments at all? I saw instructions on the Facebook developer page, but it seemed really old (also it seemed they were saying the code had to be inserted into every article manually, and it said nothing about recovering all posts).

    (sigh). I will try to see if Really Simple SSL can help me. Thanks for replying.

    • You need a 3rd-party plugin to show your facebook comments. I am just saying that for this code to work you have to use the really simple SSL plugin. This code uses a filter that modifies the output of the really simple SSl plugin. This means that if the really simple SSL plugin isn’t activated the code won’t work. Also make sure to replace the part with your own domain.

  • Leave a Reply

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

    This site uses Akismet to reduce spam. Learn how your comment data is processed.