add_clean_index() WordPress Function

The add_clean_index() function is a Wordpress function that allows you to clean up your Wordpress installation. This function will remove any unused files and folders from your installation, and will also optimize your database.

add_clean_index( string $table, string $index ) #

Adds an index to a specified table.


Parameters

$table

(string)(Required)Database table name.

$index

(string)(Required)Database table index column.


Top ↑

Return

(true) True, when done with execution.


Top ↑

Source

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;
}


Top ↑

Changelog

Changelog
VersionDescription
1.0.1Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.