Automattic / Co-Authors-Plus

Multiple bylines and Guest Authors for WordPress
https://wordpress.org/plugins/co-authors-plus/
GNU General Public License v2.0
290 stars 205 forks source link

CAP does not filter the byline that is output for posts via oEmbed; oEmbed consumers show the wrong byline #921

Open benlk opened 1 year ago

benlk commented 1 year ago

Here's a test post by a WP_User:

{
  "version": "1.0",
  "provider_name": "largo.test",
  "provider_url": "https://largo.test",
  "author_name": "WP Snapshots WP_User",
  "author_url": "https://largo.test/author/wpsnapshots/",
  "title": "Post by WP_User",
  "type": "rich",
....

And here's a test post by a Coauthor:

{
  "version": "1.0",
  "provider_name": "largo.test",
  "provider_url": "https://largo.test",
  "author_name": "WP Snapshots WP_User",
  "author_url": "https://largo.test/author/wpsnapshots/",
  "title": "Post by Guest Author",
  "type": "rich",
....
benlk commented 1 year ago

get_oembed_response_data is what provides the author and author_url keys there; it provides a filter oembed_response_data that allows us to change the response.

benlk commented 1 year ago

The problem is that it doesn't look like oEmbed supports multiple authorship: https://github.com/iamcal/oembed/issues/686

benlk commented 1 year ago

In the case of multiple bylines, since there's no support for multiple distinct authors and respective URLs, it may be easiest to do the following:

  1. author_name: use the CAP's byline generation function, then strip tags
  2. author_url: link to either the embedded page itself, or no URL
jeffpaul commented 1 year ago

@rebeccahum any thoughts from the team on an answer here or potential direction on any respective changes that could be contributed?

rebeccahum commented 1 year ago

Can you give more detail on what is trying to be achieved here with steps on reproduction?

Thanks!

benlk commented 1 year ago

The goal here is to have Slack and other oEmbed consumers show the correct author(s) in the byline. It doesn't appear that that is the case with the current version of CAP.

rebeccahum commented 1 year ago

Cool, feel free to open a PR for our review 🙂

GaryJones commented 1 year ago

Until the oembed spec changes (thanks for opening that issue), then I think the best we can do is make sure the author that is shown is the first / one of the Coauthors.