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.
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
The following error is being throw: 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
I believe this is due to CodeIgniter expecting its bootstrap index.php file to be run in global scope.
Any Ideas?