WP_Widget_Text::inject_video_max_width_style

Advertisement

Summery Summery

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

Syntax Syntax

WP_Widget_Text::inject_video_max_width_style( array $matches )

Parameters Parameters

$matches

(Required) Pattern matches from preg_replace_callback.

Return Return

(string) HTML Output.

Source Source

File: wp-includes/widgets/class-wp-widget-text.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;
	}

Advertisement

Changelog Changelog

Changelog
Version Description
4.9.0 Introduced.

See also See also

Advertisement

Leave a Reply