[wp-trac] [WordPress Trac] #40245: Youtube embeds lack title attribute
WordPress Trac
noreply at wordpress.org
Fri Mar 15 12:27:01 UTC 2019
#40245: Youtube embeds lack title attribute
--------------------------------------+----------------------------
Reporter: morriscountynj | Owner: swissspidy
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.2
Component: Embeds | Version: 2.9
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: accessibility
--------------------------------------+----------------------------
Comment (by jrf):
@afercia Good question. To be fair, I would just simplify that code block
like so:
Original code:
{{{#!php
<?php
if ( $has_title_attr ) {
$result = preg_replace( $pattern, 'title="' . esc_attr( $title ) .
'"', $result );
} else {
return str_ireplace( '<iframe ', sprintf( '<iframe title="%s" ',
esc_attr( $title ) ), $result );
}
return $result;
}}}
Suggested alternative:
{{{#!php
<?php
if ( $has_title_attr ) {
// Remove the old title.
$result = preg_replace( $pattern, '', $result );
}
return str_ireplace( '<iframe ', sprintf( '<iframe title="%s" ', esc_attr(
$title ) ), $result );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40245#comment:48>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list