从…起an example in the Developer Reference:
要获取插入对象的id,请使用$wpdb->insert_id;
global $wpdb;
$table = $wpdb->prefix.\'you_table_name\';
$data = array(\'column1\' => \'data one\', \'column2\' => 123);
$format = array(\'%s\',\'%d\');
$wpdb->insert($table,$data,$format);
$my_id = $wpdb->insert_id;