Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oEmbed field type returns url, not embed #106

Closed
2 of 3 tasks
jasonbahl opened this issue Oct 31, 2023 · 3 comments · Fixed by #111
Closed
2 of 3 tasks

oEmbed field type returns url, not embed #106

jasonbahl opened this issue Oct 31, 2023 · 3 comments · Fixed by #111
Labels
status: actionable Ready for work to begin type: enhancement Improvements to existing functionality

Comments

@jasonbahl
Copy link
Contributor

Description

As a developer querying for a field of the oEmbed type, I expect to get the embed HTML returned so that I can use it in my client application.

Instead, the field is returning the url that was input.

Steps to reproduce

  1. Create an ACF Field Group that is set to show in GraphQL
  2. Add a field of the "oembed" type
  3. Edit content that has the field group, and enter an oembed friendly URL, such as a tweet or a youtube video
  4. Query for the field in GraphQL
  5. Expect: embed HTML

I would expect an HTML payload that could be used by the client application to render the embed:

CleanShot 2023-10-31 at 08 54 32

  1. Actual: the url that was entered

With the URL being returned, this means the client application is responsible for making the oAuth requests to get the oAuth response and determine the proper markup to apply. WordPress already does this, so we should let the server handle this and return an already cached/formatted embed.

CleanShot 2023-10-31 at 08 58 24

PHP or JSON export of the ACF Field Group(s)

No response

Additional context

No response

WPGraphQL Version

1.17.0

WPGraphQL For ACF Version

latest beta

ACF (Advanced Custom Fields) Version. Free or Pro?

latest pro

WordPress Version

6.3

PHP Version

8.1

Additional enviornment details

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for WPGraphQL, WPGraphQL For ACF, ACF, etc.

  • Yes
  • My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.
@amcc
Copy link

amcc commented Jan 10, 2024

I have the opposite desire and would really prefer the url (or src of the iframe). I think this was the previous behaviour. I understand that the full iframe code may be needed by some, but if building say a react application or similar you'd probably want to handle the iframe yourself.

Some ACF fields have options to what they return - oEmbed doesn't, but perhaps this could be included in the graphQL options in ACF. Is there an existing way to get the url returned without parsing the returned html (which seems more risky).

@jasonbahl
Copy link
Contributor Author

@amcc would you mind opening that as a new issue so it doesn't get lost?

I think we can come up with a way to satisfy both options. Like a field argument that lets you choose the return format when querying the field?

Something like: iframeField( formatted: TRUE )

@jasonbahl
Copy link
Contributor Author

new issue to track here: #150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: actionable Ready for work to begin type: enhancement Improvements to existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants