I am trying to create a simple function that adds or edits data in the
<html>. Basically, before the server response is sent, I want to find where this piece of html is written at the top level of the page
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
And based on certain criteria, add a new property & value that tag.
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US" myprop1="val1" myprop2="val2">
Is there an action or filter I can hook into, at it's earliest to modify this? Most likely using regex? Side note, I understand how it break validation, but I need this for my purposes.
To answer couple questions:
- I know I can insert variables inside of html tags with just PHP. The problem is I can't find where in the WP core the actual starting
htmltag is being generated so I can replace or modify what's being generated.
- This will be in a plugin, theme independent, where the html tag is unknown, but 99% of the time it will be the standard output from Wordpress
- I can't use the header.php in a theme, as I would like this to work on whatever theme is installed. Is this specific tag always generated from the theme? Any way to override theme generated tag (if user specifies this) within a plugin?