[ACCEPTED]-Global Variables in a WordPress Plugin-wordpress-admin
Accepted answer
It turns out if you want a global variable 4 for your install function, you must declare 3 it to be global.
global $version = '1.0a';
register_activation_hook( __FILE__, 'install' );
function install() {
global $version;
add_option( 'test_version', $version );
}
More information can be 2 found at the link below under the "A 1 Note on Variable Scoping" section: http://codex.wordpress.org/Function_Reference/register_activation_hook
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.