Skip to content
WordPress.org
  • Showcase
  • Plugins
  • Themes
  • Hosting
  • News
    • Learn WordPress
    • Documentation
    • Education
    • Forums
    • Developers
    • Blocks
    • Patterns
    • Photos
    • Openverse ↗︎
    • WordPress.tv ↗︎
    • About WordPress
    • Make WordPress
    • Events
    • Five for the Future
    • Enterprise
    • Gutenberg ↗︎
    • Job Board ↗︎
  • Swag ↗︎
  • Get WordPress
Get WordPress
WordPress.org

Plugin Directory

DevLab Open Graph

  • Submit a plugin
  • My favorites
  • Log in
  • Submit a plugin
  • My favorites
  • Log in

DevLab Open Graph

By DevLab
Download
  • Details
  • Reviews
  • Installation
  • Development
Support

Description

Share a link to your site on Facebook, LinkedIn, WhatsApp, Telegram, Slack or X, and the app builds a preview from small <meta> tags in the page head. Without them, the preview is a guess. DevLab Open Graph writes those tags for you from the data you already have: the post title, excerpt, featured image and address. Descriptions are built from the saved text, without running shortcodes or the_content filters.

What it prints

  • On a post, page (not the home or posts page) or custom post type: og:title, og:description, og:image (with og:image:width, og:image:height and og:image:alt when known), og:url, og:type (article), og:site_name, og:locale, article:published_time and article:modified_time.
  • On the home page and on archives (categories, tags, other taxonomies, authors, dates, post type archives, the posts page): the same tags except article:*, with og:type website, the site name, posts page or archive title, the tagline or archive description, and your default image (a static front page’s own featured image comes first).
  • X (Twitter) Cards: twitter:card (summary_large_image when the image is large enough, summary otherwise), twitter:title, twitter:description, twitter:image, twitter:image:alt and, if you enter one, twitter:site.
  • Facebook: fb:app_id, if you enter one and Open Graph is on.

Open Graph and X Cards can be switched on and off separately. Tags without a value are left out. Search results and 404 pages get no tags.

How the values are chosen

  • Title: the post title (the site name on the home page, the archive title on archives).
  • Description: the post’s excerpt if it has one (cut at 300 characters), otherwise up to 160 characters of the content, with tags, scripts and registered shortcodes removed and cut at a word where possible. If there is neither, the site tagline. A password-protected post counts as having neither until the visitor enters the password.
  • Image: the featured image, in the smallest size at least 1200 pixels wide that keeps the proportions of the original, or the full size if there is none. If the post has no usable featured image, your default image. JPG, PNG, GIF and WebP are used; SVG and other formats are skipped, and so is an image with a side under 200 pixels.
  • Address: the canonical address of the page (the first page, for archives).

Yoast SEO and Rank Math

Yoast SEO and Rank Math normally print Open Graph and X tags themselves. When one of them is active, this plugin steps aside by default so your pages do not get duplicate tags. You can change this on the plugin’s screen: if your SEO plugin is not printing these tags (for example, you turned its social features off), untick it and this plugin will take over.

Light and quiet

The plugin stores one option (devlab_og_settings) and, for each user who dismisses its notice, one small user meta flag. It creates no tables and no post meta. On your public pages it reads that option and looks up the images it prints; the rest comes from the page WordPress is already showing. It does not touch .htaccess, keeps no persistent cache, does not crawl your site and loads no CSS or JavaScript on your public pages. Its admin CSS and JavaScript load only on its own settings screen.

For developers

  • devlab_og_should_output (filter): return false to print nothing on a given request.
  • devlab_og_data (filter): change the data the tags are made from (type, title, description, url, site_name, locale, published, modified and image) before they are printed. Every value is escaped on output.

Privacy

This plugin collects no visitor data, sends no data to anyone, makes no requests to external services and needs no account or API key. It sets no cookies. Its settings screen has links to developers.facebook.com, linkedin.com and devlab.ia.br (the last with utm_ tags that name this plugin); nothing is sent unless you click one. It never adds a credit or a link to your public pages. The tags it prints are only those listed under “What it prints” and hold no visitor data. Nothing is sent to Facebook, X or anyone else by the plugin; those services read your page when someone shares a link. The plugin does not provide legal advice and does not make your site compliant with any law.

About DevLab

DevLab builds plugins and a theme for WordPress. The plugin’s settings screen is under a DevLab menu. That screen has a small box and one dismissible notice, each with a link to the DevLab Store (devlab.ia.br/store). Nothing promotional is added anywhere else in your dashboard, and the plugin never adds a credit link to your site. The Open Graph and X Card tags in the head of your pages are the plugin’s function; nothing promotional is added to your public pages.

Facebook, X, Twitter, LinkedIn, WhatsApp, Telegram, Slack, Yoast SEO and Rank Math are trademarks of their respective owners. They are named only to describe compatibility; DevLab is not affiliated with them.

Source code

All JavaScript and CSS is plain, unminified source; there is no build step.

Screenshots

The settings screen with the Open Graph, X Cards, default image and compatibility sections.
The settings screen with the Open Graph, X Cards, default image and compatibility sections.
The warning shown when Yoast SEO or Rank Math is active and the plugin steps aside.
The warning shown when Yoast SEO or Rank Math is active and the plugin steps aside.
The tags this plugin prints in the head of a post, as seen in the page source.
The tags this plugin prints in the head of a post, as seen in the page source.
The "Test your share previews" and "Meet DevLab" boxes.
The “Test your share previews” and “Meet DevLab” boxes.

Installation

  1. Upload the devlab-open-graph folder to the /wp-content/plugins/ directory, or install the plugin from the Plugins screen in WordPress.
  2. Activate the plugin through the Plugins screen.
  3. Go to DevLab > Open Graph.
  4. Choose a default image (best size: 1200 × 630 pixels), add your X username if you have one, and click Save Changes.
  5. Share a link, or paste a page address into the Facebook Sharing Debugger or the LinkedIn Post Inspector, to see the preview.

FAQ

Where do I find the settings?

In the WordPress dashboard, under DevLab > Open Graph, or from the Settings link on the Plugins screen.

I shared a link and the preview did not change.

Facebook, LinkedIn, X and messaging apps keep a copy of the preview for a while. Ask them to fetch the page again (the Facebook Sharing Debugger and the LinkedIn Post Inspector can do that), and clear any page cache or CDN on your site, because the tags are part of the cached page.

Why do I see no tags on my site?

Check that your theme calls wp_head(), that Open Graph or X Cards is ticked, and that Yoast SEO or Rank Math is not making this plugin step aside (the settings screen says so). This plugin never adds tags to search results or 404 pages.

My SEO plugin already adds these tags.

Then leave the compatibility option ticked (it is on by default). When Yoast SEO or Rank Math is active, this plugin prints nothing, so there are no duplicates. Other SEO plugins are not detected: if you use one that prints Open Graph or X tags, switch off here the set it prints, or return false from the devlab_og_should_output filter.

I switched the social features off in my SEO plugin.

Untick “Do not add tags if Yoast SEO or Rank Math is active” and this plugin takes over. If your SEO plugin still prints one of the two sets (Open Graph or X), switch that set off here too, or its tags will appear twice.

Can I set a different title, description or image for one post?

Not in this version. The title is the post title, the description is the excerpt (else the start of the content) and the image is the featured image (else the default image). Developers can change all three with the devlab_og_data filter.

What size should my images be?

For the default image, Facebook recommends at least 1200 × 630 pixels. Featured images are chosen automatically from the sizes WordPress made: the smallest one at least 1200 pixels wide that keeps the proportions of the original, or the full size when there is none. Images with a side under 200 pixels are ignored.

Why is the home page description my site tagline?

The home page description comes from Settings > General > Tagline. If a static page is your front page and the tagline is empty, that page’s excerpt, or the start of its content, is used.

Does it work with a static front page and a posts page?

Yes. The front page is described as a website with the site name and tagline (and the page’s featured image, if it has one). The posts page gets its own title and address.

Does it show the content of password-protected posts?

Not until the visitor enters the password. Until then the description is the site tagline; the title and featured image are still used.

Why is the page type “article” for pages too?

Posts, pages and custom post types are described as article, which adds the publication and modification dates. The home page, the posts page and archives are described as website.

What is the og:locale tag?

The language of your site, from WordPress, in the form Facebook expects (for example en_US). It is left out when the WordPress locale does not have that form.

Does the plugin work with multisite?

Yes. Each site has its own settings.

What happens when I delete the plugin?

The plugin’s option and the “notice dismissed” flag are removed from the database. Deactivating it keeps them.

Does the plugin make my site compliant with privacy laws?

No. It only prints the tags listed under “What it prints”. What you may publish, and what you must tell your visitors, depends on the laws that apply to you.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“DevLab Open Graph” is open source software. The following people have contributed to this plugin.

Contributors
  • DevLab

Translate “DevLab Open Graph” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

0.1.0

  • First public release.

Meta

  • Version 0.1.0
  • Last updated 10 hours ago
  • Active installations Fewer than 10
  • WordPress version 6.0 or higher
  • Tested up to 7.1.4
  • PHP version 7.4 or higher
  • Tags
    meta tagsopen graphsocial mediasocial sharingtwitter cards
  • Advanced View

Ratings

No reviews have been submitted yet.

Your review

See all reviews

Contributors

  • DevLab

Support

Got something to say? Need help?

View support forum

  • About
  • News
  • Hosting
  • Privacy
  • Showcase
  • Themes
  • Plugins
  • Patterns
  • Learn
  • Documentation
  • Developers
  • WordPress.tv ↗
  • Get Involved
  • Events
  • Donate ↗
  • Swag ↗
  • WordPress.com ↗
  • Matt ↗
  • bbPress ↗
  • BuddyPress ↗
WordPress.org

The WordPress® trademark is the intellectual property of the WordPress Foundation.

  • Visit our X (formerly Twitter) account
  • Visit our Bluesky account
  • Visit our Mastodon account
  • Visit our Threads account
  • Visit our Facebook page
  • Visit our Instagram account
  • Visit our LinkedIn account
  • Visit our TikTok account
  • Visit our YouTube channel
  • Visit our Tumblr account
Code is Poetry