wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



wp_unique_id › WordPress Function

Depuis5.0.3
Dépréciéen/a
wp_unique_id ( $prefix = '' )
Paramètres:
  • (string) $prefix Prefix for the returned ID.
    Requis: Non
    Défaut: (vide)
Retourne:
  • (string) Unique ID.
Défini(e) dans:
Codex:

Gets 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.


Source

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