How to add data- attribute to <body> tag
I need to add a data- attribute with a user-supplied value (via custom fields) to the tag of each page. I tried editing header.php as such
body ?php astra_schema_body(); ? ?php bene_body_class(); ? data-myAttr=?php get_post_meta(get_the_id(),'my_attr')[0] ?
but when I load the page, the attribute does not show up. I'm guessing something the theme strips out all unknown attributes?
Is there a filter I can use to add it in via functions.php?
Topic page-attributes filters Wordpress
Category Web