Uses
| Uses | Description |
|---|---|
| wp-admin/includes/upgrade.php: drop_index() | Drops a specified index from a table. |
| wp-includes/wp-db.php: wpdb::query() | Performs a MySQL database query, using current database connection. |
Adds an index to a specified table.
(string) (Required) Database table name.
(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. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/add_clean_index