Removing sharedaddy’s (jetbacks sharing) extra og:description without hacking php

I’ve come across a problem where multiple plugins insert facebook opengraph meta tags into the header of my posts without letting me turn that behavior on or off. They all assume that no one explicitly puts open graph tags in their blog. This includes sharedaddy (jetpack sharing). It does so with the following comment:

Source in wordpress trak.

Problem is I’d rather define my og tags or rely on a plugin focused on doing this well.

There are several plugins to do open graph tag insertion that do a better job. You may want to roll your own directly into your theme or using one of the general SEO plugins.

So, I want to remove these extraneous tags. Online tips suggest I go into each plugin and comment out the php code inserting these tags. That’s a direct option but I hate modifying plugins. I don’t want to maintain these hacks through updates.

So, I solved with javascript. The approach is a hack. It requires that sharedaddy and other plugins insert their og:description tags before the tags I want to preserve and that I start my desired facebook tags with an fb:admins tag.

This entry was posted in software development and tagged , , , , , by Ken Judy. Bookmark the permalink.

About Ken Judy

I am an executive manager, software developer, father and husband trying to do more good than harm. I am an agile practitioner. I say this fully aware I say nothing. Sold as a tool to solve problems, agile is more a set of principles that encourage us to confront problems. Broad adoption of the jargon has not resulted in wide embrace of these principles. I strive to create material and human good by respecting co-workers, telling truth to employers, improving my skills, and caring for the people affected by the software I help build.