[wp-hackers] WP_CONTENT_DIR and PLUGINDIR

Frank Bueltge frank at bueltge.de
Tue Sep 9 15:48:36 GMT 2008


I dont use this two constants before in other plugins.

only point: get_option('siteurl') is better as url

Liebe Grüsse
Frank
______________________________
Mein Buch: WordPress - Weblogs einrichten und administrieren | ISBN
978-3-937514-33-8

bueltge.de
kvfl.com



On Tue, Sep 9, 2008 at 3:25 PM, Stephen Rider <wp-hackers at striderweb.com> wrote:
> On Sep 8, 2008, at 2:14 PM, Frank Bueltge wrote:
>
>> // Pre-2.6 compatibility
>> if ( !defined('WP_CONTENT_URL') )
>>        define( 'WP_CONTENT_URL', get_option('url') . '/wp-content');
>> if ( !defined('WP_CONTENT_DIR') )
>>        define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
>> if ( !defined('WP_PLUGIN_URL') )
>>        define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
>>
>> Thats my way in all plugins, i checl for the constants
>
> Cool, but methinks this works a touch better.  You're forgetting WP_SITEURL,
> and I added WP_PLUGIN_DIR for completeness:
>
> // Pre-2.6 compatibility
> if ( ! defined( 'WP_CONTENT_URL' ) ) {
>        if ( defined( 'WP_SITEURL' ) )
>                define( 'WP_CONTENT_URL', WP_SITEURL . '/wp-content' );
>        else
>                define( 'WP_CONTENT_URL', get_option( 'url' ) . '/wp-content'
> );
> }
> if ( ! defined( 'WP_CONTENT_DIR' ) )
>        define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
> if ( ! defined( 'WP_PLUGIN_URL' ) )
>        define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
> if ( ! defined( 'WP_PLUGIN_DIR' ) )
>        define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
>
>
> The answer to the ambiguity of PLUGINDIR is of course simply not to use it.
> :)
>
> Stephen
>
>
> --
> Stephen Rider
> <http://striderweb.com/>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list