To get the currently logged in user ID in WordPress use the following code.
<?php
$current_user_id = get_current_user_id();
echo $current_user_id;
?>
$current_user_id will give you the ID of the currently logged in user.
No comments:
Post a Comment