• I am having a problem with using my own global variables in a plugin. I want to save a value into a global variable in a plugin, and then echo that value in header.php.

    In my plugin I declare the global like this at the top of the file:

    global $dibbit_value ;

    and then set it inside a function like this:

    function xyz()
    global $dibbit_value ;
    $dibbit_value = "test" ;

    If I try and echo $dibbit_value in header.php it just comes up blank.

    If I set $dibbit_value at the top of my plugin as soon as I declare it, it works ok, but not if I try and set it within a function.

    What am I doing wrong?

    Thx

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using Global variables in a plugin’ is closed to new replies.