[wp-hackers] wp-config.php, wp-load.php, and ABSPATH

Stephen Rider wp-hackers at striderweb.com
Thu Sep 10 14:20:18 UTC 2009

On Sep 10, 2009, at 8:58 AM, Otto wrote:

> On Wed, Sep 9, 2009 at 4:35 PM, Stephen Rider <wp-hackers at striderweb.com 
> > wrote:
>> A problem that arises is plugins that do sort of "stand alone"  
>> things but
>> want to access the database -- a common thing to do is to call wp- 
>> config.php
>> directly to get the login info, rather than wp-load.php.  Again,  
>> this is
>> unstable because wp-config.php may have moved, and even if the plugin
>> correctly knows to look up a directory, it will get tripped up if  
>> it then
>> tries to call another file and bases the path off of ABSPATH.
>> While plugin authors *can* just call wp-load.php, which is safer  
>> and more
>> stable, it appears to be quite common to do it the other way.
> Short answer is that plugins should not do that.
> Long answer is that plugins that want to do "stand alone" sort of
> things need to stop thinking they are stand alone and work within the
> WordPress framework.

> if you make your output directly call a separate file
> in your plugin, and that file needs access to the database, then
> *you're doing it wrong*. You can do it within the framework, and it's
> generally much easier.
> Give me a specific example, and I'll be glad to tell you the "right"
> way that example should work. :)

Hi Otto --

You're missing the point.  All I'm trying to do is get the ABSPATH  
define removed from wp-config.php.  Reasons are:

a) it's obsolete
b) it encourages plugin coders to do it wrong (by your own definition).

Okay, I was citing loading wp-load.php as "better", but I agree that  
they're both *wrong*.

So do you concur that it would be a good idea to get rid of the  
ABSPATH define() in wp-config.php ?  :-)


Stephen Rider

More information about the wp-hackers mailing list