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

Version 2.0: oEmbed Single Entry fails in Gutenberg #981

Closed
zackkatz opened this issue Mar 22, 2018 · 8 comments
Closed

Version 2.0: oEmbed Single Entry fails in Gutenberg #981

zackkatz opened this issue Mar 22, 2018 · 8 comments
Assignees
Milestone

Comments

@zackkatz
Copy link
Member

zackkatz commented Mar 22, 2018

  1. Paste a single entry link in Gutenberg, to use oEmbed
  2. Error message: "Sorry, we could not embed that content"
  3. View the post, and the entry renders properly
  4. Return to editing the post, and it fatal errors:
    Fatal error

The Gutenberg code that fails:

<!-- wp:embed {"url":"https://gravityview-core.dev/view/stars/entry/23406/"} -->
<figure class="wp-block-embed">
    https://gravityview-core.dev/view/stars/entry/23406/
</figure>
<!-- /wp:embed -->

UPDATE: Even once that issue is fixed (See #982), the embed isn't rendered— $_GET['gv_oembed_provider'] isn't being passed, and the renderer doesn't appear to be called in time. Could be related to WordPress/gutenberg#1054 and WordPress/gutenberg#780

┆Issue is synchronized with this Asana task

@soulseekah
Copy link
Contributor

I must be doing something wrong? Latest 2.0. This is an oEmbed block:

image

Regular block works fine, there's no preview though. What am I missing?

@zackkatz
Copy link
Member Author

Just updated Gutenberg version, and it's working but still not looking right…

zackkatz added a commit that referenced this issue May 7, 2018
Fixes fatal error when embedding in Gutenberg:

![](http://share.gravityview.co/mVCkTL+)

Not a problem when running Classic Editor:

![](http://share.gravityview.co/XgCW6W+)

Related to #981
@zackkatz
Copy link
Member Author

zackkatz commented May 7, 2018

@soulseekah This is still failing for me. See the embed on .com.br

This should show a single entry:

Also, fatal error is back (confirmed on .com.br as well), fixed with 5b1d792.

@zackkatz
Copy link
Member Author

zackkatz commented May 7, 2018

@soulseekah
Copy link
Contributor

soulseekah commented May 8, 2018

Definitely not the right way:

image

I'm still figuring out what's going on, the embed handler is returning the correct embed code but it's getting filtered halfway there, by that very function, but once I identify this, a fix should be easy to implement. Stay tuned.

@soulseekah
Copy link
Contributor

Basically, there's a filter in there called wp_filter_pre_oembed_result that does a url_to_postid on the embed URL and figures that the URL is a post type, so instead of retrieving the entry - the view itself is retrieved as the entry part is lost.

An attempted fix is in 36cb534, should work well.

soulseekah added a commit that referenced this issue May 8, 2018
@zackkatz
Copy link
Member Author

zackkatz commented May 8, 2018

That looks like just the thing!

@soulseekah
Copy link
Contributor

I love our new API, the solutions themselves are so so simple to write. It does take a lot of time figuring out what to write first, though 🗡️ especially with these weird Gutenberg cases, ugh.

Glad to hear it works.

@zackkatz zackkatz closed this as completed May 9, 2018
@ghost ghost removed the Status: In Progress label May 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants