plugin_dir_url() adds path to url

For some reason I get the following output from

var_dump( plugin_dir_url( __FILE__ ) );

http://local.dev/wp-content/plugins/C:/development/xampp/htdocs/vanilla/wp-content/themes/twentyeleven/

in a local install.

Note: I deactivated all plugins and added the line on top of the functions.php file of the default and unmodified TwentyEleven Theme

1 Answer
1

There is plugin_basename() call some levels inside which seems to use WP_PLUGIN_DIR and WPMU_PLUGIN_DIR constants, so my guess would be this function is only meant to be used for things inside plugin directories and not other places like theme.

Leave a Comment