Title: Recover share count after https
Last modified: August 2, 2019

---

# Recover share count after https

 *  Resolved [Coach Afrane](https://wordpress.org/support/users/coach-afrane/)
 * (@coach-afrane)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recover-share-count-after-https/)
 * I lost all share counts after changing from http to https.
 * Whiles searching for a solution I came across this thread.
    [https://wordpress.org/support/topic/social-shares-count-recover-after-moving-to-https/](https://wordpress.org/support/topic/social-shares-count-recover-after-moving-to-https/)
 * I copied a code snippet and edited to my domain as directed
 *     ```
       function rsssl_recover_shares($html) {
           //replace the https url back to http
           $html = str_replace('og:url="https://agrihomegh.com', 'og:url="http://agrihomegh.com', $html);
           $html = str_replace('data-href="https://agrihomegh.com', 'data-href="http://agrihomegh.com', $html); 
           return $html; 
       }
       add_filter("rsssl_fixer_output","rsssl_recover_shares");
       ```
   
 * It worked ok by restoring previous share counts. However, I realized share counts
   for post after https is now reversing back to zero.
 * How can I get share counts for both before and after https combined or added 
   together ie. for both http and https?
 * Thank you.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Frecover-share-count-after-https%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [Rogier Lankhorst](https://wordpress.org/support/users/rogierlankhorst/)
 * (@rogierlankhorst)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recover-share-count-after-https/#post-11546861)
 * Hi [@coach-afrane](https://wordpress.org/support/users/coach-afrane/),
 * I have written an article on this, where I’ve also covered a method to used the
   post date to distinguish the http and https posts (scroll down to the bottom):
   
   [https://really-simple-ssl.com/knowledge-base/how-to-recover-facebook-likes-after-moving-to-httpsssl/](https://really-simple-ssl.com/knowledge-base/how-to-recover-facebook-likes-after-moving-to-httpsssl/)
 * And some plugin solutions as well.
 *  Thread Starter [Coach Afrane](https://wordpress.org/support/users/coach-afrane/)
 * (@coach-afrane)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recover-share-count-after-https/#post-11547624)
 * Thanks for your reply, Rogier.
 * I have gone through your article and it’s very helpful.
 * I tried putting the code together so I can get for both before and after https.
   
   This what I ended up with. I don’t know coding but I got this;
 *     ```
       function rsssl_recover_shares($html) {
           //replace the https url back to http
           $html = str_replace('property="og:url" content="https://agrihomegh.com','property="og:url" content="http://agrihomegh.com', $html);
           $html = str_replace('data-href="https://agrihomegh.com', 'data-href="http://agrihomegh.com', $html); 
           return $html; 
       }
       add_filter("rsssl_fixer_output","rsssl_recover_shares");
   
       $start_date = '2019-03-01';
       $publish_date = get_post_time('U', false, $post->ID);
   
       if ($start_date && ($publish_date > $start_date)) {
       //use https shares
       } else{
       //use http shares
       }
       ```
   
 * Am I right?
    Nothing is happening though.
 *  Plugin Author [Mark](https://wordpress.org/support/users/markwolters/)
 * (@markwolters)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/recover-share-count-after-https/#post-11549933)
 * Hi,
 * I don’t see the og:url propery in your page source, if it’s not there the code
   cannot replace it. You can add the og:url manually or by using an Open Graph 
   plugin to see if that does retrieve the sharecount.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Recover share count after https’ is closed to new replies.

 * ![](https://ps.w.org/really-simple-ssl/assets/icon-256x256.png?rev=2839720)
 * [Really Simple Security - Simple and Performant Security (formerly Really Simple SSL)](https://wordpress.org/plugins/really-simple-ssl/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/really-simple-ssl/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/really-simple-ssl/)
 * [Active Topics](https://wordpress.org/support/plugin/really-simple-ssl/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/really-simple-ssl/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/really-simple-ssl/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Mark](https://wordpress.org/support/users/markwolters/)
 * Last activity: [6 years, 10 months ago](https://wordpress.org/support/topic/recover-share-count-after-https/#post-11549933)
 * Status: resolved