请尝试此代码:
function test_db_install()
{
global $wpdb;
require_once(ABSPATH . \'wp-admin/includes/upgrade.php\');
$sql="
CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."imart_setting`
(
main_id bigint(20) NOT NULL auto_increment,
main_key varchar(255) default NULL,
main_value longtext,
PRIMARY KEY (`main_id`)
);";
dbDelta($sql);
$insert_sql ="
INSERT INTO `wp_posts`(`post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES (\'admin\',\'\',\'\',\'[Alumini Dashboard]\',\'Dashbord\',\'\',\'publish\',\'\',\'\',\'\',\'dashbord\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'page\',\'\',\'\')";
dbDelta($insert_sql);