WordPress at a glance
function is not described

WP_Widget_Text::inject_video_max_width_style() public WP 4.9.0

Inject max-width and remove height for videos too constrained to fit inside sidebars on frontend.

{} It's a method of the class: WP_Widget_Text{}

No Hooks.

Return

String. HTML Output.

Usage

$WP_Widget_Text = new WP_Widget_Text();
$WP_Widget_Text->inject_video_max_width_style( $matches );
$matches(array) (required)
Pattern matches from preg_replace_callback.

Notes

  • See: WP_Widget_Media_Video::inject_video_max_width_style()

Changelog

Since 4.9.0 Introduced.

Code of WP_Widget_Text::inject_video_max_width_style() WP 5.7.2

<?php
public function inject_video_max_width_style( $matches ) {
	$html = $matches[0];
	$html = preg_replace( '/\sheight="\d+"/', '', $html );
	$html = preg_replace( '/\swidth="\d+"/', '', $html );
	$html = preg_replace( '/(?<=width:)\s*\d+px(?=;?)/', '100%', $html );
	return $html;
}