Open Graph Protocol Framework
Open Graph Protocol Framework
Description
The Open Graph protocol enables any web page to become a rich object in a social graph. For instance, this is used on Facebook to allow any web page to have the same functionality as any other object on Facebook.
This WordPress plugin is aimed at automating the process of adding basic and optional metadata to a site’s pages. It is also designed to act as a framework for other plugins or themes and allows to modify and adapt the information provided as needed.
If you find this plugin useful and would like to support our work, you can do so by purchasing in our Shop, thank you!
Supports WooCommerce to include essential product metadata on product pages.
Usage
Install and activate the plugin. It will automatically render the following metadata for posts, pages, etc. :
og:title: The page’s title is used, this provides the title for posts, pages, archives etc.og:type: The type will bearticlein general,websitefor the front page andblogfor the blog homepage.og:image: For post types that support featured images, the URL of the featured image is used. Additional metadataog:image:width,og:image:height,og:image:url,og:image:secure_urlandog:image:altare added.og:url: The URL of the current page.og:site_name: The name of the site.og:description: Uses the full excerpt if available, otherwise derives it from the content. For author and archive pages, the type of page and title is used.og:locale: The current locale.og:locale:alternate: Indicates additional locales available with WPML and Polylang.
The content of the og:image:alt property is based on the Alt Text of the featured image, the image’s Caption in lack thereof, or ultimately the image’s Description in lack of the latter. If any of those are empty, the property is not rendered.
Filters
This section is for developers. If you’re not a developer, you can safely skip it.
The plugin provides the following filters:
open_graph_protocol_meta
This filter allows to modify the value of the content attribute for a given meta tag.
It is invoked for every supported type of metadata.
Parameters:
stringcontent– the current value of thecontentattributestringproperty– the metadata name, for exampleog:title
Filters must return:
stringthe desired value of thecontentattribute
open_graph_protocol_meta_tag
This filter allows to modify the actual HTML <meta> tag that is rendered in the <head> section of pages.
Parameters:
stringHTML<meta>tagstringproperty– the metadata name, for exampleog:titlestringcontent– the value of thecontentattribute
Filters must return:
stringthe desired output for the HTML<meta>tag
open_graph_protocol_metas
This filter allows to add or remove metadata before it is rendered.
Parameters:
arrayof metadata indexed by metadata name
Filters must return:
arrayof metadata indexed by metadata name
open_graph_protocol_echo_metas
This filter allows to modify the HTML that renders the plugin’s meta tags in the <head> section.
Parameters:
stringHTML with<meta>tags to be rendered
Filters must return:
stringHTML with<meta>tags to be rendered
open_graph_protocol_framework_ext
This filter allows to determine whether additional meta tags should be produced for supported integrations.
Parameters:
booleanwhether to process the integrationstringthe integration
Filters must return:
booleanwhether to process additional meta tags for the integration
Why this plugin?
This plugin was created because we needed an extendable way to render meta tags based on the Open Graph protocol, which would allow to modify the meta tag content rendered or add meta tags when appropriate based on external data.
None of the existing plugins provided a sufficiently flexible way of doing that, among other reasons we needed a solution that would comply with all of these requirements and none of the existing solutions does:
- must be compatible with WordPress 3.5
- must automatically add meta tags for featured images
- must be automated and create sensible meta tag content for each page, we don’t want to manually indicate the tag content for every page
- must provide a framework for extension through hooks and filters on every tag, and provide a design that allows other plugins to modify the meta tags in flexible ways
- must not ask to provide your Facebook account details or application ID when there is no need for it
- must not be bloated with features you don’t want or need when you simply want Open Graph metatags to be rendered automatically for your pages
Logo Attribution
The logo used for this plugin’s icon and banner is the Open Graph protocol logo by Facebook – ogp.me. Licensed under Public Domain via Wikimedia Commons.
Validators
To test the generated metadata you can use several tools, among those:
Installation
See also the Open Graph Protocol plugin pages and documentation.
- Use the Add new option found in the Plugins menu in WordPress and search for Open Graph Protocol or upload the plugin zip file or extract the
open-graph-protocolfolder to your site’s/wp-content/plugins/directory. - Enable the plugin from the Plugins menu in WordPress.
Faq
The plugin’s documentation pages are here.
You can post a comment on the plugin page.
The Open Graph protocol specification is available on ogp.me.
Reviews
Breaks custom blocks, and has conflicts with multiple Plugins
By Venelin Borisov (venelinborisov) on August 28, 2025
It breaks custom blocks, include_once used in a custom block doesn't work, and also breaks the FacetWP pluging logic.
Superb!
By snoop23 on January 7, 2024
Works like a charm. Made my day.
Thank you!
Works but too invasive.
By Mat Lipe on January 14, 2019
add_actions that you added to templates doubling up.
This plugin calls the full apply_filters on the_content when it renders which makes everything within that stack fire twice causing anomalies which are very hard to track down.
In closing: This plugin will probably work great for you if you have a vanilla site without too much customization. If you have a complex site with things like Woocommerce it's not a good fit.
Much appreciation...
By crzyhrse on November 20, 2018
Useless for beginners
By Andr? Niquet (funniq) on August 16, 2018
Exactly what I need
By jakubd on August 14, 2018
Works simple plugin
By (hayem) on December 1, 2017
Most simple and very useful
By (lne1030) on June 17, 2017
Perfect!
By Alex Williams (noahjose) on September 3, 2016
just what i've been looking for!
Changelog
See the complete changelog for details.
