WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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... – onetrickpony Mar 11 '13 at 22:15
Yes, I am trying to run it directly as a cron. How can I use it to run script directly? – тнє Sufi Mar 11 '13 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 '13 at 18:53
up vote 4 down vote accepted

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');
share|improve this answer
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. – тнє Sufi Mar 11 '13 at 22:32
How is supposed to work if you're not including the file that defines that constant? – onetrickpony Mar 11 '13 at 22:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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