向指定表添加索引。
原型
add_clean_index( string $table, string $index )
参数
$table
(string)
(Required)
数据库表名。
$index
(string)
(Required)
数据库表索引列。
返回值
(true)
是的,完成执行。
源文件
路径:wp-admin/includes/upgrade.php
<?php
...
function add_clean_index($table, $index) {
global $wpdb;
drop_index($table, $index);
$wpdb->query("ALTER TABLE `$table` ADD INDEX ( `$index` )");
return true;
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/add_clean_index/