Search code examples
phpwordpressplugins

How can I 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() is called from the plugin, it returns [wordpress_install_dir], the root of installation.)


Solution

  • Looking at the OP's own answer, I think the OP wants;

    $plugin_dir_path = dirname(__FILE__);