[wp-hackers] WP_CONTENT_DIR and PLUGINDIR

DD32 wordpress at dd32.id.au
Sun Sep 7 10:28:34 GMT 2008


Its not a bug, Rather wPhone doing it wrong, Well.. Kind of.

Theres also WP_PLUGIN_DIR which would be  
/..../wordpress/wp-content/plugins/ in a standard install

I'm not too sure of the way forward for it to work, But PLUGINDIR is  
relative to ABSPATH, whilst WP_CONTENT_DIR is not relative, but rather,  
absolute, Because of that, PLUGINDIR can never 100% be set correctly  
automatically (without using ../../../../)

My advice:
If you wish to have
ABSPATH /home/dd32/public_html/wordpress/
and
WP_CONTENT_DIR /home/dd32/wp-content/

then to also set
PLUGINDIR ../../wp-content/plugins/
for back compat with plugins which use it, and also submit a bug report to  
the plugins author.

The use of PLUGINDIR is suggested against AFAIK.

A more future-compat version might be:
define('MY_PLUGIN_DIR', dirname(__FILE__));

Or better yet..
if ( ! defined('WP_PLUGIN_DIR') )
define('WP_PLUGIN_DIR', dirname(dirname(__FILE__)));
and then simply use WP_PLUGIN_DIR instead of worrying about ABSPATH /  
PLUGINDIR


On Sun, 07 Sep 2008 20:02:23 +1000, Stephen Rider  
<wp-hackers at striderweb.com> wrote:

> Okay, I just submitted a new trac ticket*, but now I'm not sure if
> it's legit.  If not, it raises a question:
>
> The wPhone plugin (which I love, BTW, regardless of the WP iPhone
> app...) looks for the following:
>
> ABSPATH . PLUGINDIR . '/wphone/includes/header.php'
>
> This doesn't work if WP_CONTENT_DIR has a custom value, because the
> above returns the default location of the plugins directory.
>
> Is this is a bug in WP, or is wPhone doing it wrong?
>
> Stephen
>
> * http://trac.wordpress.org/ticket/7704
>
>




More information about the wp-hackers mailing list