Skip to content

HTML prefix attribute #356

@Tsquare17

Description

@Tsquare17

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions