[wp-hackers] Getting the path in which the Plugin is installed

Sudar Muthu sudar at sudarmuthu.com
Mon Oct 13 18:16:17 GMT 2008

Hi All,

Can anyone please let me know how to find the path in which my Plugin is

Say suppose my Plugin is installed inside a directory called my-plugin
inside the wp-conetent/Plugins folder then I need to get

I can get the filename alone using basename(__file__) or the entire path
using the __file__ variable. But I want to get only the directory name and
the filename.

Please let me know whether it is possible or do I have to manually parse the
__file__ variable.

Incase if you are wondering, I want this to pass to the deactivate_plugins()
function to deactivate my Plugin if the required conditions are not met.
Ofcourse I can hard code this value, but I want to handle the condition, in
which the end user might rename the folder or the filename.

Thanks in advance.

With Regards,


More information about the wp-hackers mailing list