WordPress has global functions such as wp_get_current_user(), which I can call in class methods that are under different namespaces with wp_get_current_user. However I’m not able to do so either in the class constructor or setting it to a variable (class attributes such as $user = wp_get_current_user). I’m guessing there’s a PHP rule that I’m not aware of here?

Read more here: global namespace function not available in namespaced class constructor


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: