wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_generate_uuid4 › WordPress Function

Since4.7.0
Deprecatedn/a
wp_generate_uuid4 ( No parameters )
Returns:
  • (string) UUID.
Defined at:
Codex:

Generates a random UUID (version 4).



Source

function wp_generate_uuid4() {
	return sprintf(
		'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
		mt_rand( 0, 0xffff ),
		mt_rand( 0, 0xffff ),
		mt_rand( 0, 0xffff ),
		mt_rand( 0, 0x0fff ) | 0x4000,
		mt_rand( 0, 0x3fff ) | 0x8000,
		mt_rand( 0, 0xffff ),
		mt_rand( 0, 0xffff ),
		mt_rand( 0, 0xffff )
	);
}