Recovering social shares after https nighmare

Hey everyone! I recently unexpectedly switched my site from http to https. This has been unreal as far as downtime goes, and what's worse is many of my Facebook likes on my posts were reset to 0! Is there a way to fix things? http://puregoldfish.com/fantail as you can see there are now 0 likes. It used to have I think 6. But this is across all of my posts, one of them had over 100 likes. I don't know what to do and my SEO has really tanked... :disappointed:

Thanks!

  • Kasia Swiderska
    • Support nomad

    Hello Meredith,

    Facebook keep likes for urls. And you changed url from http to https - that is different url for Facebook, thus different like count number.
    Found this thread about solving this issue https://wordpress.org/support/topic/losing-facebook-likes-when-switching-to-https-ssl/
    and this one https://wordpress.org/support/topic/losing-facebook-likes-when-switching-to-https-ssl/

    Let me know if this helps.

    kind regards,
    Kasia

  • Meredith
    • The Bug Hunter

    Hi Kasia,

    I took a look at the thread but couldn't find where to change the og:url on each page. The solution mentioned was to change something with a different social sharing plugin than the one I use, which is the floating social plugin by WPMU. Any ideas?

    Thanks!

  • Nithin
    • Support Wizard

    Hi Meredith,

    Hope you are doing good today. :slight_smile:

    You could try manually adding the open graph urls, as mentioned in this article:
    https://www.elegantthemes.com/blog/tips-tricks/how-to-add-open-graph-tags-to-wordpress

    function doctype_opengraph($output) {
        return $output . '
        xmlns:og="http://opengraphprotocol.org/schema/"
        xmlns:fb="http://www.facebook.com/2008/fbml"';
    }
    add_filter('language_attributes', 'doctype_opengraph');
    
    function fb_opengraph() {
        global $post;
    
        if(is_single()) {
            if(has_post_thumbnail($post->ID)) {
                $img_src = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'medium');
            } else {
                $img_src = get_stylesheet_directory_uri() . '/img/opengraph_image.jpg';
            }
            if($excerpt = $post->post_excerpt) {
                $excerpt = strip_tags($post->post_excerpt);
                $excerpt = str_replace("", "'", $excerpt);
            } else {
                $excerpt = get_bloginfo('description');
            }
            ?>
    
        <meta property="og:title" content="<?php echo the_title(); ?>"/>
        <meta property="og:description" content="<?php echo $excerpt; ?>"/>
        <meta property="og:type" content="article"/>
        <meta property="og:url" content="http://yourWebsiteURL"/>
        <meta property="og:site_name" content="<?php echo get_bloginfo(); ?>"/>
        <meta property="og:image" content="<?php echo $img_src; ?>"/>
    
    <?php
        } else {
            return;
        }
    }
    add_action('wp_head', 'fb_opengraph', 5);

    You can copy the above code, and paste it into your themes functions.php file. In the above given code, please make sure to replace your website url, in http for og:url meta tag.

    Would highly recommend that you make changes like this to a theme using a Child theme, so that it won't be overwritten when you update your theme.

    Please let us know if you still need any further assistance. Have a nice day. :slight_smile:

    Kind Regards,
    Nithin

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.