Okay to call wp_get_current_user from filter?
-
Hi
The wp_get_current_user documentation says that:
“Use the init or any subsequent action to call this function. Calling it outside of an action can lead to troubles”
But people sometimes write that one wold want to call it from an action *or* filter. It works okay when I call it from a filter. Is it okay to call it from a filter?
The docs:
https://codex.www.ads-software.com/Function_Reference/wp_get_current_userIs it usually okay to call functions from both filters & actions, if the docs says it’s okay to call them from an *action* but doesn’t mention filters?
Regards, Magnus
- The topic ‘Okay to call wp_get_current_user from filter?’ is closed to new replies.