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);
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]