Get logged in user with – custom plugin

Instead of using init hook why don’t you use the wp_loaded hook. This way, you’re sure that everything is loaded

add_action('wp_loaded','do_stuff');
function do_stuff(){
    $current_user = wp_get_current_user();
    if ($current_user->ID > 0) {
        // rest of your code here
        // $current_user->ID will give you the ID of the current user.
    }
}

techhipbettruvabetnorabahisbahis forumueduseduseduedueduedusedusedueduedu