This is what in my wp-config.php :

if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

I am calling from plugin/pluginName directory to :

require_once( ABSPATH . 'wp-includes/user.php');

But it is returning:

Warning: require_once(ABSPATHwp-includes/user.php) [function.require-once]: failed to open stream: No such file or directory in /home/------/wp-content/plugins/---/---.php on line 43

Fatal error: require_once() [function.require]: Failed opening required 'ABSPATHwp-includes/user.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/------/wp-content/plugins/---/---.php on line 43

Any idea why I am having this error? Any solution? Thanks.

  • 4
    Are you running your script directly? If so, you need to load WP before you can use its constants. Or at least include wp-config... Mar 11, 2013 at 22:15
  • Yes, I am trying to run it directly as a cron. How can I use it to run script directly? Mar 11, 2013 at 22:19
  • It's telling you right here: "ABSPATHwp-includes/user.php". You need a slash in there. "ABSPATH/wp-includes/user.php:
    – Drew Baker
    Jun 12, 2013 at 18:53

1 Answer 1


If you just need that class included, and your script is located in the plugin directory, like /wp-content/plugins/pluginName/script.php, then you can do:

require realpath('../../../wp-includes/class-phpass.php');
  • Anyway, I was able to load it putting the full path (realpath). Thanks. But I don't understand, why ABSPATH is not working! It should be working. Mar 11, 2013 at 22:32
  • 2
    How is supposed to work if you're not including the file that defines that constant? Mar 11, 2013 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.