Add Embed Preview support for classic embed providers#6345
Merged
Conversation
aduth
reviewed
Apr 25, 2018
lib/compat.php
Outdated
| } | ||
| } | ||
|
|
||
| if ( is_wp_error( $response ) || ! $local_oembed ) { |
Member
There was a problem hiding this comment.
If I'm reading correctly, couldn't this be an else to the above if ( $data ) {? The is_wp_error( $response ) || seems redundant with the previous condition, also wouldn't need the $local_oembed variable:
<?php
if ( is_wp_error( $response ) ) {
// It's possibly a local post, so lets try and retrieve it that way.
$post_id = url_to_postid( $_GET['url'] );
$data = get_oembed_response_data( $post_id, apply_filters( 'oembed_default_width', 600 ) );
if ( $data ) {
// It's a local post!
$response = (object) $data;
} else {
global $wp_embed;
$html = $wp_embed->shortcode( array(), $_GET['url'] );
if ( $html ) {
return array(
'provider_name' => __( 'Embed Handler', 'gutenberg' ),
'html' => $html,
);
}
}
}
Member
Author
There was a problem hiding this comment.
Good call, I think it was a left over from a previous iteration of the code: I wasn't able to reproduce any issues after changing it.
Co-Authored-By: Andrew Duthie <aduth@users.noreply.github.com>
9bcce91 to
7a3e933
Compare
nylen
pushed a commit
to nylen/wordpress-develop-svn
that referenced
this pull request
Jun 23, 2020
See WordPress/gutenberg#6345 Fixes #45447. Props swisspidy, pento, audrasjb, aduth, jrchamp, thrijith, TimothyBlynJacobs, whyisjake. git-svn-id: https://develop.svn.wordpress.org/trunk@48135 602fd350-edb4-49c9-b593-d223f7449a82
pento
pushed a commit
to WordPress/wordpress-develop
that referenced
this pull request
Jun 23, 2020
See WordPress/gutenberg#6345 Fixes #45447. Props swisspidy, pento, audrasjb, aduth, jrchamp, thrijith, TimothyBlynJacobs, whyisjake. git-svn-id: https://develop.svn.wordpress.org/trunk@48135 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith
pushed a commit
to markjaquith/WordPress
that referenced
this pull request
Jun 23, 2020
See WordPress/gutenberg#6345 Fixes #45447. Props swisspidy, pento, audrasjb, aduth, jrchamp, thrijith, TimothyBlynJacobs, whyisjake. Built from https://develop.svn.wordpress.org/trunk@48135 git-svn-id: http://core.svn.wordpress.org/trunk@47904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
gMagicScott
pushed a commit
to gMagicScott/core.wordpress-mirror
that referenced
this pull request
Jun 23, 2020
See WordPress/gutenberg#6345 Fixes #45447. Props swisspidy, pento, audrasjb, aduth, jrchamp, thrijith, TimothyBlynJacobs, whyisjake. Built from https://develop.svn.wordpress.org/trunk@48135 git-svn-id: https://core.svn.wordpress.org/trunk@47904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
donmhico
pushed a commit
to donmhico/wordpress-develop
that referenced
this pull request
Jun 26, 2020
See WordPress/gutenberg#6345 Fixes #45447. Props swisspidy, pento, audrasjb, aduth, jrchamp, thrijith, TimothyBlynJacobs, whyisjake. git-svn-id: https://develop.svn.wordpress.org/trunk@48135 602fd350-edb4-49c9-b593-d223f7449a82
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Before the magic of oEmbed, there was
wp_embed_register_handler(). It was kind of hacky, but it was a forerunner for easy embedding we have today.There are lots of plugins that still use it, however, so we should bring them into the Gutenberg-y future. This PR extends Embed Block previews to include classic embed providers.
Fixes #3499.
How has this been tested?
Tested with some plugins that use embeds.
Or:
Checklist: