This useful PHP code snippet shows you how to use a WordPress function to get the current user id. This code shows creating the user id as a PHP string variable and displaying it using echo.
1 2 3 4 5 6 7 8 |
<?php $the_user_id = get_current_user_id(); echo '$the_user_id'; ?> |