Is there a way for a plugin to add an attribute to the tag of a theme?

You can probably use the language_attributes filter (from the language_attributes() function) to add it.

It should receive an output like lang="en" and you can add to it before printing to the <html> tag:

add_filter( 'language_attributes', function( $attr )
{
    return "{$attr} manifest=\"manifest.appcache\"";
} );

or without a anonymous function

add_filter( 'language_attributes', 'wpse140730_add_manifest_to_language_attributes' );

function wpse140730_add_manifest_to_language_attributes($output) {

    return $output . ' manifest="manifest.appcache"';

}

Leave a Comment