DatabaseUtil::drop_table_index()publicWC 1.0

Drops a table index, if both the table and the index exist.

Метод класса: DatabaseUtil{}

Хуков нет.


true|false. True if the index has been dropped, false if either the table or the index don't exist.


$DatabaseUtil = new DatabaseUtil();
$DatabaseUtil->drop_table_index( $table_name, $index_name ): bool;
$table_name(строка) (обязательный)
The name of the table that contains the index.
$index_name(строка) (обязательный)
The name of the index to be dropped.

Код DatabaseUtil::drop_table_index() WC 9.1.2

public function drop_table_index( string $table_name, string $index_name ): bool {
	global $wpdb;

	if ( empty( $this->get_index_columns( $table_name, $index_name ) ) ) {
		return false;

	// phpcs:ignore WordPress.DB.PreparedSQL
	$wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" );
	return true;