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



get_current_user_id › WordPress Function

Depuis
Dépréciéen/a
get_current_user_id ( Pas de paramètres )
Retourne:
  • (int) The current user's ID, or 0 if no user is logged in.
Défini(e) dans:
Codex:
Changelog:
  • MU

Gets the current user's ID.



Source

function get_current_user_id() {
	if ( ! function_exists( 'wp_get_current_user' ) ) {
		return 0;
	}
	$user = wp_get_current_user();
	return ( isset( $user->ID ) ? (int) $user->ID : 0 );
}