Support » Plugins » Hacks » Fatal error when including files in plugin.

  • Resolved whiteatom

    (@whiteatom)


    Hello.. I’m getting a “Fatal error: Call to undefined function wp_get_current_user() in /wordpress-directory/wp-includes/capabilities.php on line 1059” when I add a php include_once() or require_once() in my plugin.

    I have come across other people with this issue and the fix is to require pluggable.php at the top of the capabilities file. I don’t want to do that as I want this to install in any word press installation.

    All i have now is an include to a blank file and it’s still causing the problem.

    Any ideas?

    Cheers,

    whiteatom

Viewing 1 replies (of 1 total)
  • Thread Starter whiteatom

    (@whiteatom)

    Ok.. I am an idiot for not thinking of this.. but as soon as I wrote the late post I thought of something else to try.

    You cannot name a file in your plugin the same as a file in the wordpress core – the include scope is too broad.

    I had my 2 widgets in a file called widgets.php – renamed it and all is well. Hope this helps someone else.

Viewing 1 replies (of 1 total)
  • The topic ‘Fatal error when including files in plugin.’ is closed to new replies.