WP_Background_Process::generate_key( int $length = 64 )

Generate key

Description

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

Parameters

$length

(int) (Optional) Length.

Default value: 64

Return

(string)

Source

File: bp-core/libraries/wp-background-process.php

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

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

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.