[resolved] Fatal error when including files in plugin. (2 posts)

  1. whiteatom
    Posted 5 years ago #

    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?



  2. whiteatom
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.