Make WordPress Core

Opened 5 years ago

Last modified 3 months ago

#53573 new defect (bug)

Non-WP Blog Embeds are being cropped.

Reported by: mdwolinski's profile mdwolinski Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.7.2
Component: Embeds Keywords: close
Focuses: ui, css Cc:

Description

When adding an embed for a non-WP blog post, for example, a NY Times story, the enclosing iFrame is not getting a default height set to it, which is causing the embed to crop off most of the information.

Issue seems to be the iframe generated is not expanding to include all of the content from the embed. If I manually set height: 400px; on the iframe, for example, it shows the content. However, the bottom is still cut off (seems the height of the embed in this case is 457px). The ma.tt embed in the screenshot has a height as an attribute of the iframe, the NYTimes does not.

@mamaduka tested this issue in both the Block Editor and Classic Editor with similar results. See comment here: https://github.com/WordPress/gutenberg/issues/28490

Attachments (2)

121894941-b58a7e80-cced-11eb-8b48-1e91078eec9a.png (344.1 KB) - added by mdwolinski 5 years ago.
Current result of adding NY Times post Embed
121895192-f2567580-cced-11eb-9ab6-2268fc13e62e.png (1.3 MB) - added by mdwolinski 5 years ago.
Embed with iFrame height manually adjusted.

Download all attachments as: .zip

Change History (4)

@mdwolinski
5 years ago

Current result of adding NY Times post Embed

@mdwolinski
5 years ago

Embed with iFrame height manually adjusted.

#1 @desrosj
5 years ago

  • Component changed from Editor to Embeds
  • Keywords needs-testing added

I'm able to reproduce the issue, but only for the NYTimes. I'm not sure why the height is being omitted, especially since it's being included in the REST API response.

#2 @r1k0
3 months ago

  • Keywords close added; needs-testing removed

Reproduction Report

Environment

  • WordPress: 6.9
  • PHP: 8.4.17
  • Server: PHP.wasm
  • Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
  • Browser: Chrome 144.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins: None activated
  • Plugins:
    • NYTimes Embed 1.0.0
    • Test Reports 1.2.1

Steps taken

  1. First, add a test plugin to enable support for NYTimes embed. Code is below in Support content section.
  2. Head over to Posts > Add post, and add the embed block.
  3. Paste a NYTimes article link, and publish the post.
  4. Go to the frontend and observe the height of the embedded post.
  5. ❌ Bug is not occurring

Expected behavior

  • The NYTimes post is displayed in full height.

Additional Notes

  • This issue seems to have been resolved.
  • Unable to pinpoint the exact code that fixed this issue.
  • You need the test plugin, since NYTimes embeds are not in the WP allowed list.
  • Related: ticket:49173, Gutenberg: 13000.

Screenshots/Screencast with results

In Editor:
https://i.ibb.co/84G9XnYv/embed-nytimes-post-editor.png

In frontend:
https://i.ibb.co/nN543vGy/embed-nytimes-frontend.png

Support Content


<?php
/**
* Plugin Name: NYTimes Embed
* Description: Add support for nytimes embed
* Version: 1.0.0
*/

if ( ! defined( 'ABSPATH' ) ) {
        exit;
}

function nytimes_register_oembed_provider() {
        wp_oembed_add_provider( '#https?://(www\.)?nytimes\.com/.*#i', 'https://www.nytimes.com/svc/oembed/json/', true );
}

add_action( 'init', 'nytimes_register_oembed_provider' );
Note: See TracTickets for help on using tickets.