WP_Background_Process::generate_key()protectedWC 1.0

Generate key

Generates a unique key based on microtime. Queue items are given a unique key so that they can be merged upon save.

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

Хуков нет.

Возвращает

Строку.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->generate_key( $length );
$length(int)
Length.
По умолчанию: 64

Код WP_Background_Process::generate_key() WC 8.7.0

protected function generate_key( $length = 64 ) {
	$unique  = md5( microtime() . rand() );
	$prepend = $this->identifier . '_batch_';

	return substr( $prepend . $unique, 0, $length );
}