我想向wp\\U用户添加更多自定义表
但我希望它们包含默认的JSON数据
这一个有效。。。当默认值为空时。。。
register_activation_hook(__FILE__, \'toto_user_db_setup\');
function toto_user_db_setup() {
global $wpdb;
$user_data = "wp_users";
$charset_collate = $wpdb->get_charset_collate();
$game_1 = "CREATE TABLE $user_data (
data1 tinytext DEFAULT \'\' NOT NULL,
data2 tinytext DEFAULT \'\' NOT NULL,
data3 mediumtext DEFAULT \'\' NOT NULL,
data4 mediumtext DEFAULT \'\' NOT NULL,
data5 longtext DEFAULT \'\' NOT NULL
) $charset_collate;";
require_once( ABSPATH . \'wp-admin/includes/upgrade.php\' );
dbDelta($game_1);
}
但当我在默认值中输入任何值时。。。它根本不起作用
register_activation_hook(__FILE__, \'toto_user_db_setup\');
function toto_user_db_setup() {
global $wpdb;
$user_data = "wp_users";
$charset_collate = $wpdb->get_charset_collate();
$game_1 = "CREATE TABLE $user_data (
data1 tinytext DEFAULT \'test1\' NOT NULL,
data2 tinytext DEFAULT \'test2\' NOT NULL,
data3 mediumtext DEFAULT \'hello\' NOT NULL,
data4 mediumtext DEFAULT \'2132\' NOT NULL,
data5 longtext DEFAULT \'dada\' NOT NULL
) $charset_collate;";
require_once( ABSPATH . \'wp-admin/includes/upgrade.php\' );
dbDelta($game_1);
}
我确实试着让它在几个小时内工作。。。。。但什么都没有。。。。请帮忙。