Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_unique_id ›

Da4.9.9
Deprecaton/a
wp_unique_id ( $prefix = '' )
Parametri:
  • (string) $prefix Prefix for the returned ID.
    Richiesto: No
    Default: (vuoto)
Ritorna:
  • (string) Unique ID.
Definito a:
Codex:

Get unique ID.

This is a PHP implementation of Underscore's uniqueId method. A static variable contains an integer that is incremented with each call. This number is returned with the optional prefix. As such the returned value is not universally unique, but it is unique across the life of the PHP process.



Sorgenti

function wp_unique_id( $prefix = '' ) {
	static $id_counter = 0;
	return $prefix . (string) ++$id_counter;
}