courseCheckLogin = '<?php echo get_current_user_id() ?>'; code example Example: wp get logged in user id <?php $user_id = get_current_user_id(); ?>