Wordpress-seo: LinkedIn grabs wrong oEmbed data via WP Core, not Yoast oEmbed data

Created on 31 Mar 2020  路  4Comments  路  Source: Yoast/wordpress-seo

  • [x] I've read and understood the contribution guidelines.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

When using the Post Inspector tool on LinkedIn to see how pages would look when shared, I noticed that the data being pulled for each page and post was coming from WP Core's discovery links (https://developer.wordpress.org/reference/functions/wp_oembed_add_discovery_links/). The data was not coming from the oEmbed data that Yoast SEO plugin was adding to the page. As such, fields like page title did not include site name, separators, and so on, but instead, only included the internal page title used in the Wordpress editor. The oEmbed data generated by Yoast seems to be completely ignored by LinkedIn, defaulting back to WP Core's oEmbed data.

LinkedIn was correctly grabbing the Open Graph data, but since LinkedIn prioritizes oEmbed data, it was using the oEmbed data from WP Core as the value. To get around this, I disabled the discovery links from being added by Wordpress so LinkedIn falls back to Open Graph tags.

Please describe what you expected to happen and why.

I expected the oEmbed data generated by Yoast to override the WP Core oEmbed data, reflecting things like titles and descriptions that have been tailored to the page using the Yoast SEO plugin. Instead, I had to disable WP Core from adding the default oEmbed data via the <link /> element, forcing LinkedIn to fallback to Open Graph data.

remove_action( 'wp_head', 'wp_oembed_add_discovery_links');

How can we reproduce this behavior?

  1. Create a page or post in Wordpress as usual
  2. Using Yoast SEO plugin on that page, change the title to include variables like Site Name and Separators & save (alternatively, update these values programmatically with Yoast plugin filters)
  3. Put the URL to the page you created into LinkedIn's post inspector tool
  4. The title the post inspector uses for the post/page will be the non-Yoast formatted title

LinkedIn's data
LinkedIn's data

Technical info


* If relevant, which editor is affected (or editors):
- [x] Classic Editor
- [x] Gutenberg
- [x] Classic Editor plugin


* Which browser is affected (or browsers):
- [x] Chrome
- [x] Firefox
- [x] Safari

Used versions

  • WordPress version: 5.3.2
  • Yoast SEO version: 13.4 (Yoast SEO & Yoast SEO Premium)
  • Relevant plugins in case of a bug: Yoast SEO & Yoast SEO Premium
  • Tested with theme: Twenty Nineteen & Custom theme
0.5 innovation feature request

Most helpful comment

All 4 comments

@jono-alderson were you able to create a feature request regarding this LinkedIn bug?

Not yet. On my to-do list. Needs some investigation.

Alright!

I propose that we should alter the oembed properties (at /wp-json/oembed/1.0/embed) to match the contents of the metadata on the page. Specifically. we should:

  • Set the title property to match the og:title.
  • Add a description property which matches the og:description.
Was this page helpful?
0 / 5 - 0 ratings