bog bog - 6 months ago 16
PHP Question

How to get the current plugin directory in WordPress?

I need to get the current plugin directory like

[wordpress_install_dir]/wp-content/plugins/plugin_name


(if
getcwd()
called from the plugin, it returns
[wordpress_install_dir]
, the root of installation)

thanks for help

Answer

Looking at your own answer @Bog, I think you want;

$plugin_dir_path = dirname(__FILE__);