wordpress php get user id code example
Example 1: wp get logged in user id
<?php
$user_id = get_current_user_id();
?>
Example 2: wordpress get user by id
$user_obj = get_user_by('id', 1);
<?php
$user_id = get_current_user_id();
?>
$user_obj = get_user_by('id', 1);