Every time I use wp_get_current_user() my plugin breaks
You can get current user ID easily using get_current_user_id(). $usersid = get_current_user_id(); $activity = $_POST[‘activity’]; $reason = $_POST[‘reason’]; $explanation = $_POST[‘explanation’]; For your function f2user() you can change your code to this: $current_user = wp_get_current_user(); return $current_user->ID; According to wp_get_current_user() doc, if no user is signed in, $current_user->ID would return 0.