I am currently working on a small task that store a plugin information into database, but I have problem regarding to include the file that has the functions to run the query.
Here is the line that includes the file:
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
but I got the following when I run the code:
Warning:
require_once(ABSPATHwp-admin/includes/upgrade.php)
: failed to open stream: No such file or directory in/home/najam/dev/project1/wordpress/wp-admin/admin-insert.php
on line 18
I searched a lot but can't find anything useful or helpful.
EDIT
Here is my code:
global $wpdb;
$table_name = $wpdb->prefix . 'table_form';
$sql = "CREATE TABLE $table_name (
id int(11) NOT NULL AUTO_INCREMENT,
rows int(11) DEFAULT NULL,
cols int(11) DEFAULT NULL,
UNIQUE KEY id (id)
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta( $sql );`
ABSPATH
does not appeared to be defined. Where are you using it?ABSPATH
and beforewp-admin/
. Try this:ABSPATH . '/wp-admin/
. And consider this StackOverflow WP Question also./wp-admin/admin-insert.php
? This is not in the core. Are modifying the WordPress core?