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

Derek derek at amphibian.info
Fri Sep 11 18:01:28 UTC 2009


I'm actually encountering this right now ... I'm making a call to:

'../../../../wp-load.php'

... from within a subdirectory of my plugin directory.  Obviously, if
someone has chosen to move wp-content elsewhere, this breaks.  So,
here's a specific example Otto.  ;)

What I'm doing is exporting data from my plugin's DB tables into a CSV
file from the admin. I can't have any other output to the browser so I
can set proper headers for the file.

Any ideas as to how I can achieve this from strictly within the WP
framework?

Best,
Derek

On Sep 11, 12:43 pm, Otto <o... at ottodestruct.com> wrote:
> Well, like I said, my problem with that is that you shouldn't do the
> other one either.
>
> If you wanted to put something in there like "you shouldn't include
> this file directly, go read this documentation for the right way
> instead" then I'd be more okay with it.
>
> -Otto
>
> On Thu, Sep 10, 2009 at 8:51 PM, Stephen Rider
>
>
>
> <wp-hack... at striderweb.com> wrote:
>
> > On Sep 10, 2009, at 9:25 AM, Otto wrote:
>
> >> So, you're asking if we should instantly and intentionally break every
> >> plugin that includes wp-config.php?
>
> >> Yeah, I'm fine with it. ;)
>
> > Heh.  Okay, to rephrase the question (via quoting myself):
>
> >> Here is my proposal: We should assert, in documentation and in code, that
> >> any time a plugin or process wants to access parts of WP (including the
> >> database), it should call wp-load.php.
>
> > ...
>
> >> [W]e should put a "deprecated" call with the define() in wp-config (inside
> >> the "if it doesn't already exist" clause), so that if it does happen, there
> >> is a notice to the log that "You should not call wp-config.php directly.
> >> Call wp-load.php instead."  Then somewhere down the road we can get rid of
> >> the troublesome define.
>
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hack... at lists.automattic.com
> >http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hack... at lists.automattic.comhttp://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list