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

Matt Martz matt at sivel.net
Fri Sep 11 18:10:10 UTC 2009


On Fri, Sep 11, 2009 at 2:01 PM, Derek <derek at amphibian.info> wrote:
> 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

Perhaps one of the best solutions is using admin-ajax.php.

Take a look at the source, and you will quickly find out how easy it
is to use and how to use it.

-- 
Matt Martz
matt at sivel.net
http://sivel.net/


More information about the wp-hackers mailing list