diff --git a/wp-includes/user.php b/wp-includes/user.php index 9a60cd2069..a0cb8d815f 100644 --- a/wp-includes/user.php +++ b/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 ); }