get_option error plugin development

How plugins loading works

WordPress has, as any other software, a specific order in which files get loaded. During loading WPs core files, there’re specific points where you can either hook into do_action() or alter data during apply_filters() calls. Those functions always get called with a minimum of one argument: The name. Sometimes there’re more arguments, which then are the callbacks.

Point is, that you have to wait until certain hooks to have some parts of the public API available.

The rule…

Never ever just execute code without wrapping it into a function or method (the mentioned callback) which you then hook. For more information about the order in which those hooks appear, take a look at the Codex and the Plugin API & Action Reference.