Depending on the context, it may not be possible. For example, sub-site code making an API request for main site content. The domains do not match, so no auth cookie is sent and the current user cannot be determined by the API handler. XML-RPC requests never have a user ID.
Post the code you’re using and describe the context. Maybe someone will be able to check it out for you.
Hi,
Issue:1
When wp_get_current_user() is used for getting admin id, and loggined as admin getting ‘0’.also tried get_current_user_id().
Issue 2:
When loggined as super admin, and tried to get user ID using wp_current_user() and get_current_user_id() getting ‘0’. When getting emailid shows email(:protected). Com. Any other methods?
Hi,
Can you give me an update of the attached issue .Please let me know if you require more time.Thank you for your attention.
Thanks.