On this page
plugin_dir_url( string $file ): string
Get the URL directory path (with trailing slash) for the plugin __FILE__ passed in.
Parameters
$filestring Required-
The filename of the plugin (__FILE__).
Return
string the URL path of the directory that contains the plugin.
Source
File: wp-includes/plugin.php. View all references
function plugin_dir_url( $file ) {
return trailingslashit( plugins_url( '', $file ) );
}
Related
Uses
| Uses | Description |
|---|---|
| plugins_url() wp-includes/link-template.php | Retrieves a URL within the plugins or mu-plugins directory. |
| trailingslashit() wp-includes/formatting.php | Appends a trailing slash. |
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/plugin_dir_url