title: How do I include CodeIgniter within a WordPress plugin?
body: <p>I have a WordPress website. I am writing a plugin for WordPress where I want to use the CodeIgniter framework within the plugin. I am having trouble with this because the CodeIgniter bootstrap file "index.php" expects to be run in the global scope, not within a function.</p>
  
  <pre>
  Right now, within my plugin, I do the following:
  // BEGIN: plugin code
  function classifieds_template_redirect()
  {
    global $wp;
    $plugin_path = plugin_dir_path(__FILE__);
    if (preg_match('/^CI/', $wp->request))  // Use CodeIgniter to handle the request
    {
      include($plugin_path."/index.php";  // Include the CodeIgniter bootstrap file
      die();
    }
  
  }
  add_action( 'template_redirect', 'classifieds_template_redirect' );
  // END: plugin code
  </pre>
  
  <p>The following error is being throw:</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function item() on a non-object in /usr/local/apache/htdocs/site.utils/htdocs/CodeIgniter/system/core/Utf8.php on line 47</p>
  </blockquote>
  
  <p>I believe this is due to CodeIgniter expecting its bootstrap index.php file to be run in global scope.</p>
  
  <p>Any ideas?</p>