When working out what is going on in WordPress

If you find this free website useful – why don’t you support this with a donation? It is easy…. read more ….


it is sometimes useful to be able to see what globals exist.

This snippet of code shows globals and excludes a couple of the big wordpress objects that probably are not of any use


foreach ($GLOBALS as $key => $value) {
if (($key!=’GLOBALS’) && ($key!=’wp_object_cache’) && ($key!=’wp_filter’)){
if ((!is_object($value)) && (!is_array($value))) {
echo "key= ".$key. " value= ".$value."<br>";
} else {
echo "key= ".$key." .. array/object <br>";
echo "<br>… end array/object <br>";

The code displays objects and arrays too. just add $ to the key to get the global and use it in your wordpress theme code.
This is advanced investigation into what WordPress is doing, when examining complex plugins and themes. This is not for beginners, but for wordpress developers.



, ,




Leave a Reply

Your email address will not be published. Required fields are marked *