get_comments not working on custom post types

For some reason, ‘user_id’ => $user->ID, is not working since I did not set global current_user on. The first three lines should be replaced with something like this:

<?php
$args = array(
        'user_id' => get_current_user_id(),

Now it’s working 🙂

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)