Beans icon indicating copy to clipboard operation
Beans copied to clipboard

HTML prefix attribute

Open Tsquare17 opened this issue 7 years ago • 0 comments

The prefix attribute is added by SEO plugins like Yoast and All in One SEO with Social meta. This results in output such as the following.

Yoast: <html lang="en-US" prefix="og:" http://ogp_me/ns#="">

All in One SEO Pack with Social Meta <html lang="en-US prefix=og:" http://ogp_me/ns#="">

I think at least part of the problem is due to the valid space it contains (https://www.w3.org/TR/rdfa-core/#A-prefix) being improperly filtered.

Both plugins add the attribute via add_filter() on language_attributes.

The issue can be replicated by attempting to add the prefix attribute from functions.php with the following:

add_filter( 'language_attributes', 'html_prefix' );
function html_prefix( $atts ) {
	$prefix = 'prefix="og: http://ogp.me/ns#"';
	$atts  .= ' ' . $prefix;
	return $atts;
}

Tsquare17 avatar Dec 08 '18 18:12 Tsquare17