I am trying to write a wp plugin. In my project i have 3 php file.
- My plugin file
- Widget for the plugin
- Data installation
I need to install data table on plugin activation.
For that sake I wrote code to create table for my plugin in data installation file. But I am not able to create data table using this file.
My code for include data installation file and widget file in my plugin file is
define ( 'OTHER_FILES_PATH', plugin_dir_path(__FILE__) );
require_once( OTHER_FILES_PATH.'/data_installation.php' );
require_once( OTHER_FILES_PATH.'/plugin_widget.php' );
My problem is when I put my data installation code in My plugin file it’s working fine but when I put it in separate file (data installation) I am unable to create tables for my plugin.
Please let me know if I am making any mistake. Thanks