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

Matthew Martz matt at sivel.net
Mon Oct 13 18:38:10 GMT 2008


On Mon, Oct 13, 2008 at 2:16 PM, Sudar Muthu <sudar at sudarmuthu.com> wrote:
> Hi All,
>
> Can anyone please let me know how to find the path in which my Plugin is
> installed?
>
> Say suppose my Plugin is installed inside a directory called my-plugin
> inside the wp-conetent/Plugins folder then I need to get
> my-plugin/my-plugin-filename.php
>
> 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,
> Sudar
>
> http://SudarMuthu.com

plugin_basename(__FILE__)

-- 
Matt Martz
matt at sivel.net


More information about the wp-hackers mailing list