[Plugin: WordPress SEO by Yoast] OpenGraph Issue when also using SEO with Root Relative URLs plugin
-
==> WordPress version: 3.4.2
==> WordPress SEO version: 1.2.8.7==> I did this:
Note that I have the Root Relative URLs plugin well as a plugin that lets me place a Facebook Like button on my page (have tried several actually). It first came to my attention while troubleshooting an issue with Facebook Like counters using the Facebook Developer’s Debugger.
==> I expected the plugin to do this:
I expected the plugin to generate the correct code regardless of what other plugins might be installed. Example:
<meta property='og:url' content='https://www.yoursite.com/'/>
While I realize that Root Relative URLs plugin is at the root of the problem, it is crucial that WordPress SEO take the initiative to ensure all URL’s are complete.
This is especially important in instances where the information is a link that another site, like Facebook, will be using to refer back to your website.
==> Instead it did this:
With the Root Relative URLs plugin installed, WordPress SEO generates the following OpenGraph line of code:
<meta property='og:url' content='/'/>
==> Here is how to fix the problem
In the case of og:url, it is possible to fix the OpenGraph og:url meta property by editing the file named wp-content/plugins/wordpress-seo/frontend/class-opengraph.php and replace this line…
echo "<meta property='og:url' content='" . esc_attr( $this->canonical( false ) ) . "'/>\n";
… with the following two lines …
$SiteRoot = (substr(esc_attr( $this->canonical( false ) ),0,1) == '/' ? (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https" : "http") : '') . "://" . $_SERVER['HTTP_HOST']; echo "<meta property='og:url' content='". $SiteRoot . esc_attr( $this->canonical( false ) ) . "'/>\n";
Please fix this problem as soon as possible. Until this fix is included in WordPress SEO, folks will always have to remember to apply the fix each time they update the WordPress SEO plugin.
==> So why is this important to me?
Facebook makes use of the ‘og:url’ meta property.
Unfortunately you won’t see the problem on my site (https://www.tngconsulting.ca) unless I forget to re-apply the fix after updating WordPress SEO. That being said, I would be happy to assist the developers of WordPress SEO with this reproducible issue.
Best regard,
Michael Milette
- The topic ‘[Plugin: WordPress SEO by Yoast] OpenGraph Issue when also using SEO with Root Relative URLs plugin’ is closed to new replies.