woocommerce_database_max_index_length хук-фильтрWC 8.0.0

Filters the maximum index length in the database.

Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that. As of WP 4.2, however, they moved to utf8mb4, which uses 4 bytes per character. This means that an index which used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters.

Additionally, MyISAM engine also limits the index size to 1000 bytes. We add this filter so that interested folks on InnoDB engine can increase the size till allowed 3071 bytes.

Использование

add_filter( 'woocommerce_database_max_index_length', 'wp_kama_woocommerce_database_max_index_length_filter' );

/**
 * Function for `woocommerce_database_max_index_length` filter-hook.
 * 
 * @param int $max_index_length Maximum index length.
 *
 * @return int
 */
function wp_kama_woocommerce_database_max_index_length_filter( $max_index_length ){

	// filter...
	return $max_index_length;
}
$max_index_length(int)
Maximum index length.
По умолчанию: 191

Список изменений

С версии 8.0.0 Введена.

Где вызывается хук

DatabaseUtil::get_max_index_length()
woocommerce_database_max_index_length
woocommerce/src/Internal/Utilities/DatabaseUtil.php 346
$max_index_length = apply_filters( 'woocommerce_database_max_index_length', 191 );

Где используется хук в WooCommerce

Использование не найдено.