Uses
Uses | Description |
---|---|
wp-includes/formatting.php: trailingslashit() | Appends a trailing slash. |
Get the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in.
(string) (Required) The filename of the plugin (__FILE__).
(string) the filesystem path of the directory that contains the plugin.
It is a wrapper for trailingslashit( dirname( $file ) );.
The “plugin” part of the name is misleading – it can be used for any file, and will not return the directory of a plugin unless you call it within a file in the plugin’s base directory.
File: wp-includes/plugin.php
function plugin_dir_path( $file ) { return trailingslashit( dirname( $file ) ); }
Version | Description |
---|---|
2.8.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/plugin_dir_path