WordPress Global Variable funktioniert nicht

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();
Lokesh003Coding