From eba5ddbcfa363255abc0a530edd669bddd91cf33 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 26 Oct 2013 03:19:41 +0000 Subject: [PATCH] Have get_current_user_id() return 0 when pluggable.php is not yet included (which brings the ability to set or get the current user). fixes #25690 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@25929 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/user.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php index 9a60cd2069..a0cb8d815f 100644 --- a/src/wp-includes/user.php +++ b/src/wp-includes/user.php @@ -212,6 +212,8 @@ function count_many_users_posts( $users, $post_type = 'post', $public_only = fal * @return int 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 ); }