I am trying to write a WordPress plug-in. In my project I have three PHP files.
- My plug-in file
- Widget for the plug-in
- Data installation
I need to install data table on plug-in activation. For that sake I wrote code to create table for my plug-in 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 plug-in 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 plug-in file it’s working fine but when I put it in separate file (data installation) I am unable to create tables for my plug-in.
Please let me know if I am making any mistake.