New answers tagged fatal-error
The WordPress environment is not yet fully initialized when your plugin files are loaded, it's almost always too early to safely run code that interacts with core at that point. WordPress achieves its initial state through a process which contains its own set of actions and filters, so plugins load before that happens to allow them to hook into that ...
As toscho already said, you need to load the file a template. Otherwise you can try to include the wp-load require('wp-load.php'); You can find it in the WordPress Root Directory - so perhaps you need to add the path to wp-load in the require. This should help you.
Top 50 recent answers are included