[wp-hackers] WP_CONTENT_DIR and PLUGINDIR

Stephen Rider wp-hackers at striderweb.com
Mon Sep 8 14:42:34 GMT 2008


On Sep 7, 2008, at 5:28 AM, DD32 wrote:

> 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 ../../../../)

> A more future-compat version might be:

> 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

That's generally my way to go lately:  Check if the newer constant has  
been defined, and if not, define it, then use it normally.  That way  
your plugin works just fine even in WP versions before the constant  
existed.

To Viper -- I wasn't trying to criticize wPhone.  The WP app  
notwithstanding, I still love this plugin, and I hope it continues to  
be developed -- at least for base compatibility purposes.

Stephen

-- 
Stephen Rider
<http://striderweb.com/>





More information about the wp-hackers mailing list