I can confidently say that it is empty at the point at which your code checks the variable. The three possibilities are:
$user_id
is not set or is set to an incorrect value. As you don’t
show the code that sets this value, I can’t tell.- You are using the wrong key.
- Something is hooked into
get_user_metadata
and is causing a
problem.
While I am not 100% sure, I am fairly sure that those are an exclusive list.
If you can post your code with more context I might be able to do better.