This page redirects to an external site: https://developer.wordpress.org/reference/functions/get_current_user_id/
Returns the ID of the current viewer if they are logged in. Returns 0 if the viewer is not logged in.
None.
<?php get_current_user_id( ); ?>
<?php
$user_id = get_current_user_id();
if ($user_id == 0) {
echo 'You are currently not logged in.';
} else {
echo 'You are logged in as user '.$user_id;
}
?>