Answers for "make variable global in wordpress"

PHP
0

wordpress global variable not working

global $g_value;  
//declare it global even before assigning it., this should fix it.

$g_value = 'something';
echo $g_value;

function get_value() {
    global $g_value;
    print $g_value;
}

echo get_value();
Posted by: Guest on February-05-2021
0

global function wordpress

### Temporary Solution
you can write function inside th wp-config which will be available in all the
files
Posted by: Guest on February-05-2021

Browse Popular Code Answers by Language