Is it good practice in WordPress to add extra keys to the global array $wp (or any global variable in WordPress for that matter).
I need to access my theme options in all the files in WordPress but I am not sure if this is the best approach.
Something like:
$wp['theme-options] = $theme_options;
What do you mean by ‘all files in WordPress’? If you’re talking about passing variables from your functions/plugin into a template file, those are stored within the global $wp_query object. You can use the get() and set() methods –
Then in your template file, you will have $foo all ready to go.