Summery Summery
Filters the given oEmbed HTML to make sure iframes have a title attribute.
Syntax Syntax
Parameters Parameters
- $result
-
(Required) The oEmbed HTML result.
- $data
-
(Required) A data object result from an oEmbed provider.
- $url
-
(Required) The URL of the content to be embedded.
Return Return
(string) The filtered oEmbed result.
Source Source
File: wp-includes/embed.php
}
$title = ! empty( $data->title ) ? $data->title : '';
$pattern = '`<iframe([^>]*)>`i';
if ( preg_match( $pattern, $result, $matches ) ) {
$attrs = wp_kses_hair( $matches[1], wp_allowed_protocols() );
foreach ( $attrs as $attr => $item ) {
$lower_attr = strtolower( $attr );
if ( $lower_attr === $attr ) {
continue;
}
if ( ! isset( $attrs[ $lower_attr ] ) ) {
$attrs[ $lower_attr ] = $item;
unset( $attrs[ $attr ] );
}
}
}
if ( ! empty( $attrs['title']['value'] ) ) {
$title = $attrs['title']['value'];
}
/**
* Filters the title attribute of the given oEmbed HTML iframe.
*
* @since 5.2.0
*
* @param string $title The title attribute.
* @param string $result The oEmbed HTML result.
* @param object $data A data object result from an oEmbed provider.
* @param string $url The URL of the content to be embedded.
*/
$title = apply_filters( 'oembed_iframe_title_attribute', $title, $result, $data, $url );
if ( '' === $title ) {
Advertisement
Changelog Changelog
| Version | Description |
|---|---|
| 5.2.0 | Introduced. |