Does the notice appear with all plugins disabled using the Twenty Fifteen theme?
You got me, Henry! No, it does not. I now have been turning on/off other plugins and I got a combination: “Twenty Fifteen”, BuddyPress and “Favicon by RealFaviconGenerator”. If I turn off either BuddyPress or Favicon, the message disappear. Do you wish me to report it to Favicon, or would you look first what exactly is wrong?
It’s probably worth reporting the issue to Favicon and hopefully the authors will release an update fixing the problem.
Let us know how you get on and if you need any more info, just shout.
While working on other plugin, I came across that this message appears when current_user_can()
is called from within ‘plugins_loaded’ action. If user authentication is not expected at this point, then this proves that it is not BuddyPress problem.
Which action, as early as possible, would you recommend to use expecting current_user_can()
to work properly?
current_user_can()
uses wp_get_current_user()
. Looking at the function reference for that function, I noticed “Use the init or any subsequent action to call this function”. Take a look at the Action Reference article for the list of actions run during a typical page request. The action you use will depend on what exactly you’re doing but it looks as though the earliest available when using current_user_can()
is init
Hope this helps 🙂
Ref:
https://codex.wordpress.org/Function_Reference/wp_get_current_user
https://codex.wordpress.org/Plugin_API/Action_Reference
This is really helpful, Henry.
I submitted a link to this thread to “Favicon by RealFaviconGenerator”.
Thanks a lot.
Hi,
I’m the author of the Favicon by RealFaviconGenerator plugin.
Just to follow up: the plugin v1.2.10 fixes the issue.
The issue can caused by a early call to is_super_admin. This function was called to decide if some action registrations were necessary or not. The fix was to move all these to a function called upon the init action. No more warning!
John, would you confirm you don’t have the warning anymore?
Yes, all good, thank you, @phbernard!
Great! Issue resolved! 🙂