get_current_user_id()

最后更新于:2021-11-26 09:04:00

get_current_user_id()

Get the current user’s ID

响应

(int) The current user’s ID, or 0 if no user is logged in.

源文件

文件: gc-includes/user.php

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