wpseek.com
WordPress开发者和主题制作者的搜索引擎



get_current_user_id › WordPress Function

Since
已弃用n/a
get_current_user_id ( 没有参数 )
返回:
  • (int) The current user's ID, or 0 if no user is logged in.
定义在:
文档:
Change Log:
  • MU

Gets the current user's ID.



源码

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 );
}