drop_index() - WordPress 函数参考中文文档

返回介绍

drop_index()

发布于 2017-09-10 字数1580 浏览 833 评论 0

drop_index( string $table,  string $index )

Drops a specified index from a table.


描述


参数

$table

(string)
(Required)
Database table name.

$index

(string)
(Required)
Index name to drop.


返回值

(true) True, when finished.


源代码

File: wp-admin/includes/upgrade.php

function drop_index($table, $index) {
	global $wpdb;
	$wpdb->hide_errors();
	$wpdb->query("ALTER TABLE `$table` DROP INDEX `$index`");
	// Now we need to take out all the extra ones we may have created
	for ($i = 0; $i < 25; $i++) {
		$wpdb->query("ALTER TABLE `$table` DROP INDEX `{$index}_$i`");
	}
	$wpdb->show_errors();
	return true;
}

更新日志

Version 描述
1.0.1 Introduced.

相关函数

Uses

  • wp-includes/wp-db.php:
    wpdb::query()
  • wp-includes/wp-db.php:
    wpdb::hide_errors()
  • wp-includes/wp-db.php:
    wpdb::show_errors()

Used By

  • wp-admin/includes/upgrade.php:
    add_clean_index()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!