Skip to content

Poster image URL in core/video block is not directly accessible #40529

@mattortega

Description

@mattortega

What problem does this address?

I would like to retrieve the poster image URL from the core/video block but the only way to do is through regex of the entire inner HTML.

\includes\global\loop.php:40:

array (size=5)
  'blockName' => string 'core/video' (length=10)
  'attrs' => 
    array (size=1)
      'id' => int 356
  'innerBlocks' => 
    array (size=0)
      empty
  'innerHTML' => string '
<figure class="wp-block-video"><video controls poster="POSTER URL" preload="auto" src="VIDEO URL" playsinline></video><figcaption>This is a video caption</figcaption></figure>
' (length=319)
  'innerContent' => 
    array (size=1)
      0 => string '
<figure class="wp-block-video"><video controls poster="POSTER URL" preload="auto" src="VIDEO URL" playsinline></video><figcaption>This is a video caption</figcaption></figure>

What is your proposed solution?

Make "poster," specifically the URL of the image, an accessible object. It may be useful to access the caption as its own object as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions