• Resolved spiros

    (@spiros)


    I moved to SSL and lost Facebook likes. How can I modify og:url in Yoast SEO so that it shows http instead of https?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Sa?a

    (@stodorovic)

    You can see https://github.com/Yoast/wordpress-seo/issues/6239.
    If you don’t know how to add filter, but you have experience with FTP client, I can explain you how to create simple “must-use plugin”.

    PS. it’s possible to add og:image:secure_url (https://ogp.me/). I’ll try to update code snippet on github.

    • This reply was modified 8 years, 2 months ago by Sa?a.
    Thread Starter spiros

    (@spiros)

    Yes, I can use FTP but adding a filter how and where?
    I have also htaccess code sending all traffic to https

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    Sa?a

    (@stodorovic)

    Related to filter, you can use must-use plugins for it. ( https://codex.www.ads-software.com/Must_Use_Plugins )
    You should create folder wp-content/mu-plugins if it doesn’t exist. Then you can create simple file, eg. yoast-seo-fix-ogurl.php with content:

    <?php
    /**
     * Plugin Name: Yoast SEO fix for og:url
     * Description: Replaces https with http in og:url
     * Version: 1.0.0
     */
    
    add_filter( 'wpseo_opengraph_url', 'replaces_opengraph_url_to_http' );
    
    function replaces_opengraph_url_to_http( $url ) {
            return str_replace( 'https://', 'https://', $url );
    }
    

    Upload this file into wp-content/mu-plugins. When you open WP dashboard and go to plugins, you will see Must-Use(1). There, you will see info that this file is loaded. You can’t disable/enable this plugin, you need to delete file if you don’t want to use it more.

    It’s simple way how to can add custom code. (some simple filters, …)

    Thread Starter spiros

    (@spiros)

    That was all done and confirmed in dashboard. However, when I check the source I see https in og:url. Moreover, which plugin should I use to display a FB Like button? Yoast SEO does not seem to provide one and the one I was using before adds its own Open Graph strings.

    <meta property="og:url" content="https://aidoion.com/i-monogamia-odigise-se-exafanisi-to-osto-tou-anthropinou-peous/" />
    <meta property="og:site_name" content="Βιβλ?ο για γυνα?κε? (αποφθ?γματα, ανθολογ?α, ρητ?, σεξ)" />
    <meta property="article:publisher" content="https://www.facebook.com/aidoion" />
    <meta property="article:section" content="Δι?φορα" />
    <meta property="article:published_time" content="2016-12-14T11:27:00+02:00" />
    <meta property="fb:app_id" content="188257277975226" />
    <meta property="og:image" content="https://aidoion.com/wp-content/themes/responsive/images/aidoion-73.jpg" />
    <!-- / Yoast SEO plugin. -->
    • This reply was modified 8 years, 2 months ago by spiros.
    Sa?a

    (@stodorovic)

    It’s possible that other plugin uses same filter, or something like this. You can try to add higher priority for filter. Change line to:

    add_filter( 'wpseo_opengraph_url', 'replaces_opengraph_url_to_http', 99999 );

    I can’t give good advice relate to sharing button. I’ve good experience with ESSB (Easy Social Share Buttons), but it’s premium plugin. My friend uses Super Socializer, Social Media and Share Icons (Ultimate Social Media) …

    Thread Starter spiros

    (@spiros)

    In fact it was Really Simple SSL plugin which had “Auto replace mixed content” checked that was affecting it. I unchecked and the mu plugin produced an http og:url. However, this did not result in displaying old http page likes (I also had to remove manually the og strings from “Simple Facebook Connect” I use to display social buttons so that there is no duplicate content).

    Edit: I went to https://developers.facebook.com/tools/debug/ and debugged and scraped again the URL which resulted in likes reappearing. But do I have to rescrape its URL?

    • This reply was modified 8 years, 2 months ago by spiros.
    Sa?a

    (@stodorovic)

    @spiros Sorry for delay, I think that re-scraping should be fix this. I’m not sure for all details. You can see similar issue: https://github.com/Yoast/wordpress-seo/issues/2118

    Really Simple SSL plugin uses PHP output buffers:

    public function start_buffer(){
      ob_start(array($this, "filter_buffer"));
    }

    So, there aren’t way to you can exclude og tags. From other side, output buffers can slowdown website and it’s recommended to you try to resolve all mixed content on other ways if it’s possible.

    Thread Starter spiros

    (@spiros)

    Thanks Sa?a for excellent support! I have disabled “Auto replace mixed content” in all my WP sites ??

    Yes, it works when rescraping, the only issue being the 50 pages limit for rescraping through the batch invalidator (some sites can have thousands of pages).

    https://developers.facebook.com/tools/debug/sharing/batch/

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Move to SSL, losing Likes’ is closed to new replies.