title: Wordpress: PHP Fatal error: Call to undefined function get_option()
body: <p>I've searched almost everywhere, but proposed answers didn't help me.</p>
  
  <p>Problem: I've got a Wordpress installation, last version (3.6.1). I've done a clean install multiple times, looked into the <code>wp-includes/option.php</code> and other files and I'm pretty sure it all works and all has the correct content.</p>
  
  <p>I'm developing a plugin, and I'm making use of the Wordpress-defined function <code>get_option</code>. Whenever my code calls that function, I get a <code>500: internal server error</code> response. Weird, cause the code of a plugin should be called from within the Wordpress framework...</p>
  
  <p>Make it even more weird: other functions defined in those included files, like <code>add_options_page</code>, work perfectly and behave like they should.</p>
  
  <p>So, for example, this works:</p>
  
  <pre><code>$pageTitle = "Title for my Options Page";
  $menuLink = "Title for my Menu Link";
  $userAccessLevel = 8; //that's admin
  $pageSlug = "slug-to-my-plugin-options-page";
  $callbackFunction = array($this, 'optionsPage');
  add_options_page($pageTitle, $menuLink, $userAccessLevel, 
          $pageSlug, $callbackFunction);
  </code></pre>
  
  <p>But this doesn't:</p>
  
  <pre><code>get_option("ntp_myoption");
  </code></pre>
  
  <p>Both <code>add_options_page</code> and <code>get_option</code> are defined in source files in the same folder (<code>wp-includes\option.php</code> and <code>wp-includes\plugin.php</code>), both functions are effectively in those files, both blocks of code above are in the same file in my plugin, I didn't include or require any file.</p>
  
  <p>Anyone has a clue?</p>
  
  <hr>
  
  <p>As asked, the full block of code from where I call <code>get_option</code> - it is from the constructor of my class that wraps the plugin.</p>
  
  <pre><code>function __construct() {
      global $wpdb;
      $this-&gt;table_iso = $wpdb-&gt;prefix . "ntp_iso";
      $this-&gt;pluginUrl = get_option('siteurl') . '/wp-content/plugins/my-plugin';
  }
  </code></pre>
  
  <p>Also maybe worth to mention: I've got a class that wraps the actual plugin, and in the bottom of that .php file, I've got (outside the class definition), this code:</p>
  
  <pre><code>global $tp;
  $tp = new MyPlugin();
  $plugin = plugin_basename(__FILE__);
  
  register_activation_hook( __FILE__, array($tp, 'install'));
  register_deactivation_hook( __FILE__, array($tp, 'deactivate'));
  add_action('add_meta_boxes', array($tp, 'init'));
  if (is_admin()) {
      add_action('admin_menu', array($tp, 'addOptionsPage'));
      add_filter("plugin_action_links_$plugin", array($tp, 'addSettingsLink'));
  }
  </code></pre>
  
  <p>These all work like a charm.</p>