add_clean_index
Adds an index to a specified table.
Description
Parameters (2)
- 0. $table (string)
- Database table name.
- 1. $index (string)
- Database table index column.
Usage
if ( !function_exists( 'add_clean_index' ) ) { require_once ABSPATH . '/wp-admin/includes/upgrade.php'; } // Database table name. $table = ''; // Database table index column. $index = ''; // NOTICE! Understand what this does before running. $result = add_clean_index($table, $index);
Defined (1)
The function is defined in the following location(s).
- /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;
- }