Access Multiple WordPress Global Variables

If you want to access multiple WordPress global variables in a function, you need to separate them by commas. So, in the function below, we want to access both the wp_version and required_php_version variables. In order to do that, we simply have to separate them by commas. See the example below:

public function example_function(){
    global $wp_version, $required_php_version;
    echo 'WordPress Version'.$wp_version.' Required PHP Version:'.$required_php_version;
}

Leave a Reply

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