wp_get_current_user returns an ID of 0 even if user logged in
-
I have been troubleshooting an issue where we use the Restrict Content Pro plugin to try and restrict access to documents created by WP Document Revisions. This is failing under certain circumstances. I have traced the failure to a filter function in RCP hooked to ‘template_redirect’. The problem appears to be in how the current logged in user is established. For example, even though I am logged into the site on which I am attempting to display the document, the wp_get_current_user() call comes back with a user with ID 0. This seems to be related to the fact that documents are custom posts. I have tried the same thing with other custom post types and they work fine, so it seems unique to WPDR. The other interesting thing is that this only occurs on commercially hosted site I use. I have reproduced the setup locally on a personal server and it works perfectly. Unfortunately, since the WPDR plugin is warning about not being tested with that level of WordPress, the folks hosting my site won’t support me.
What I am looking for is some direction from someone who understands the plugin and WordPress better than I do to figure out how to debug the problem.
- The topic ‘wp_get_current_user returns an ID of 0 even if user logged in’ is closed to new replies.