{$prefix}_body_attributes
This is a filter hook that can be used for filtering the output of the hybrid_body_attributes() function, which displays the attributes for the <body>
tag.
Parameters
This hook passes a single parameter of $attributes
, which is an array of attribute/value pairs for the <body>
element.
Usage
The following adds the id
attribute and a value to the attributes.
Add this code to your theme setup function:
add_filter( "{$prefix}_body_attributes", 'my_body_attributes' );
Add to your theme’s functions.php
:
function my_body_attributes( $attributes ) {
$attributes['id'] = 'wordpress';
return $attributes;
}