Get right to it: how to fix this.
Update: it turns out Jetpack modules can be disabled individually, though you’d probably never know without being told. In the Jetpack screen, find the module you want to disable and click the “Learn more” button. An info box slides down and the “Configure” button magically changes to say “Disable.” Hit the new disable button and that module will shut down.
In order to get rid of the unwanted OG tags, you’ll have to disable the Publicize and Sharing modules. I also disabled Enhanced Distribution, just to be sure.
The fastest way to fix the problem is to strip Jetpack’s unnecessary <og:...>
tags from your header. Add this line to your theme’s functions.php file (solution originally published by Yoast a few days ago):
add_filter('jetpack_enable_opengraph', '__return_false', 99);
The add_filter()
function is WordPress’ method of hooking a function to a filter action. In other words, it extends a PHP object, allowing theme and plugin developers to customize some of the system’s functionality without modifying any of the core files.
- The “jetpack_enable_opengraph” parameter tells WordPress which filter to modify. Anytime WP comes across the
jetpack_enable_opengraph()
function, it will add our custom filter to it. - The “__return_false” parameter tells WordPress what it should add to the
jetpack_enable_opengraph()
function. This is the business end of our hook. It will disable the function’s output, stripping the unwanted tags. - And the “99” parameter sets the priority for our custom filter. The higher the number, the lower the priority, and the later the filter hook will be applied. In this case, we want our filter hook to be applied late, so everything else finishes and then ours runs.
What’s the problem, anyway?
Both Jetpack and WordPress SEO are adding <og>
tags to your header and Facebook doesn’t like that. Personally, I don’t see why it’s a problem, as long as the tags all match, but oh well. Facebook will be Facebook.
If you’re like me, you’re using WordPress SEO because it’s awesome and you don’t want to mess it with it or limit its abilities. Jetpack, on the other hand, I really only use for a quick glance at my site’s stats and for its new comment form. I don’t care about it otherwise. I’ve even written about how to disable Jetpack’s CSS output. So, in my opinion, the solution is clear: get Jetpack out of the way and let WP SEO keeping being awesome.
[/blog_stripe]Other potential solutions.
If you’d rather not mess with the add_filter()
hook in your functions file, there are two other solutions you might consider to remedy this problem.
1) Disable WordPress SEO’s OG tags
I don’t recommend this one, but if you want to go this route, it’s perfectly easy to do. Just navigate to WordPress SEO’s settings and find the “Social” settings screen. Uncheck the “Add OpenGraph meta data” box and hit save.
2) Install Manual Control for Jetpack
This plugin, Manual Control for Jetpack, isn’t meant to do exactly what we need for in this case. The plugin author says, “Jetpack auto-activates new modules, without asking your permission. This plugin stops that.” But I’m not sure that’s is good enough. I can’t seem to deactivate already-activated Jetpack modules.
3) Maybe you’re not using WordPress SEO
If you’re not using WordPress SEO and you’re getting this conflict anyway, try disabling any other SEO or social media-related plugin to see if the problem goes away.
I prefer to go straight to the source and disable the Jetpack output via my functions file. But if you’d prefer the admin-interface method, either of these should do the trick.
[blog_stripe]Yoast hit the nail on the head.
In his post about this conflict, Yoast nailed it and called out the Jetpack team on their shit:
…the developers at Automattic seem to think they’re alone in the world. In their last release, they enabled OpenGraph tags by default with no setting to disable it.
I said something similar in not so many words in my last post about Jetpack CSS: “Long story short: get out of my way, Jetpack. This is my website and I’m styling it how I want to. (Frankly, I think WP should allow users to toggle default styles on and off.)” The same thing applies here, Automattic. Let users control their site. It feels like you’re pigeonholing us into your plugin and forcing us to do things your way. Not cool.
[/blog_stripe]
I’m having a problem with my site for days now because the sharing buttons is fetching the wrong URL. Now I know the culprit is the OG URL of the plugin. Thanks a bunch for sharing the solution! You made my day. kudos to you!
You’re welcome! Happy I could help.
I followed your instructions to deactivate those three Jetpack modules, but now I have no social sharing buttons on my posts. So how do I share to FB, pinterest, etc?
Hi Kathleen, thanks for your comment. You have a few options. Before getting into them, have you tried the “other potential solutions” listed in the post?
If so, and you’re still having trouble, here’s what you might try:
1) Find another social sharing plugin to replace Jetpack’s functionality (though you may end up with the same problem if the new plugin prints its own og:url tag).
2) Deactivate WordPress SEO and find another SEO plugin (or none at all, though any other SEO plugin will probably cause the same problem)
3) Modify either Jetpack or WordPress SEO so it no longer prints the og:url tag (not recommended).
4) Add a function to your theme’s functions.php file stripping out WPSEO’s og:url tag (as opposed to stripping Jetpack’s as described above).
5) Reactivate the modules and deal with the conflict.
I seem to have a similar issue where before I made the update to latest Jetpack and WP every post was automatically posted on my FB page now it doesn’t It only works with witter, path, linkedin and tumbler. but not for FB and G+
Thanks for your comment, Bander. It sounds like your Facebook authentication may need to be updated. I haven’t tested, but I don’t know of any conflict with Jetpack and Facebook. Either way, I’m not sure that it’s related to this “More than one OG URL” error.