Recovering missing Facebook comments (and like counts) after switching to SSL

You might notice that you are missing your Facebook comments once you switch to HTTPS from serving your site initially on HTTP. The problem is with Facebook not linking the old URLs with the new ones, which is why you might have to do some additional work in order to have your comments back.

It’s important to notice that you’ll still have your Facebook comments form and you might even have some new comments there from after you switched to using SSL, but the old ones from before that would be gone. Not irreversibly, though.

Here is the solution I found in a couple of Forum threads. It worked great for me:

  1. Install and activate Really Simple SSL plugin (;
  2. See if your dashboard breaks. It did on one of my sites due to some weird environment edge case.
  3. Add a custom replacement for HTML attributes that would contain  the address of the website with HTTPS, instead of HTTP:
add_action('rsssl_fixer_output', 'rsssl_exclude_http_url');

function rsssl_exclude_http_url($html) {
  $html = str_replace('data-href="', 'data-href="', $html);
  return $html;

Oh, it’s usually the same problem with Facebook likes, so don’t worry that much if all of a sudden you lost all your Facebook like stats on your like buttons in the site. Same solution should fix this too.


4 responses to “Recovering missing Facebook comments (and like counts) after switching to SSL”

  1. Hello Vladimir,

    I have to installed the simple ssl plugin

    Where is add this code?

    I have 2 functions files



    Thank you for your reply.

    1. Vladimir Vassilev Avatar
      Vladimir Vassilev

      Hi, Carlos,

      This one is the standard file for this kind of fixes:


  2. Do you thing that solution will work if urls are with changet slugs? I rename the post slugs and i changed fom http to https is it possible solution without simple ssl, just to add code into premalinks href?

    1. Vladimir Vassilev Avatar
      Vladimir Vassilev

      Sorry for the late reply, but I’ve missed your comment earlier. I doubt it that it would work without some hacking if you’ve changed the slug of a post.
      Still, if you’ve sorted out a solution to this, please share it here, as I’m curious to hear how it could work out.

Leave a Reply

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