[wp-hackers] Access files inside a plugin directory?

Otto otto at ottodestruct.com
Wed Mar 24 16:04:13 UTC 2010


Just noticed this thread, but yes, that is definitely preferable to
symlinking anything. The whole purpose of those constants is
specifically to allow you to move those directories to elsewhere in
the filesystem.

Constants you'd care about:
WP_PLUGIN_DIR
WP_PLUGIN_URL
PLUGINDIR  (backward compatibility)
WPMU_PLUGIN_DIR
WPMU_PLUGIN_URL
MUPLUGINDIR (backward compatibility)

Using a plugin dir from elsewhere would require you to set at least
the first three of those in the wp-config. That would probably be the
best solution.

-Otto



On Tue, Mar 23, 2010 at 6:44 PM, Stephen Rider
<wp-hackers at striderweb.com> wrote:
> Another thought:  If you're customizing WP_PLUGIN_DIR and WP_PLUGIN_URL, you could always set the DIR constant to the **actual** directory of the shared plugins.  Might fix a lot of the __FILE__ problems.
>
> On Mar 23, 2010, at 9:18 AM, Jeremy Clarke wrote:
>
>> Is using __FILE__ an accepted practice in WP-land? I have many
>> installs where I use symlinks ( ln -s ) to share plugin/theme
>> directories between multiple installations, and any use of __file__
>> completely screws up file includes in that setup. Most plugins manage
>> to avoid it but the ones that use it need to be modified by hand.
>>
>> Isn't it presumptive or something? Seems dangerous to have as a best practice.
>
> _______________________________________________
> 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