函数原型
add_clean_index( string $table, string $index ): true
函数描述
Adds an index to a specified table.
是否弃用
未弃用
函数参数
-
$table
string
Required - Database table name.
-
$index
string
Required - Database table index column.
函数返回值
true True, when done with execution.
函数位置
File: wp-admin/includes/upgrade.php.
函数源码
function add_clean_index( $table, $index ) {
global $wpdb;
drop_index( $table, $index );
$wpdb->query( "ALTER TABLE `$table` ADD INDEX ( `$index` )" );
return true;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 1.0.1 | Introduced. |

