add_clean_index()
Adds an index to a specified table.
No Hooks.
Return
true
. True, when done with execution.
Usage
add_clean_index( $table, $index );
- $table(string) (required)
- Database table name.
- $index(string) (required)
- Database table index column.
Notes
- Global. wpdb. $wpdb WordPress database abstraction object.
Changelog
Since 1.0.1 | Introduced. |
add_clean_index() add clean index code WP 6.8
function add_clean_index( $table, $index ) { global $wpdb; drop_index( $table, $index ); $wpdb->query( "ALTER TABLE `$table` ADD INDEX ( `$index` )" ); return true; }