Using a WordPress action you can include PHP global variables in your html without having to modify any theme files.
When working on PHP based sites I frequently include the PHP global variables as a comment in the html. For security reasons I only display it for my IP address.
In a few WordPress themes that I have developed I have modified the header.php file to include the same code. After some recent WordPress coding using filters I examined ways to see the global variables without modifying the theme files. This is exactly what WordPress hooks, filters and actions were created for.
The obvious choice was to use the add_action() function to call my function in the header area (use the wp_head action hook). The plugin can be installed in the Must Use Plugins directory (named ‘mu-plugins’) so that one doesn’t even have to log into the dashboard to enable it (though I note that this method has some caveats but they are not a problem for this).
', "\n"; } } ?>
The next step is to create an options panel in the dashboard to allow setting of the IP address. The code can be expanded further to include more WordPress variables.