plugin_dir_url( string $file )
Get the URL directory path (with trailing slash) for the plugin __FILE__ passed in.
Description Description
Parameters Parameters
- $file
-
(string) (Required) The filename of the plugin (__FILE__).
Return Return
(string) the URL path of the directory that contains the plugin.
Source Source
File: wp-includes/plugin.php
function plugin_dir_url( $file ) { return trailingslashit( plugins_url( '', $file ) ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
2.8.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Basic Example
Would echo:
Let’s say current URL is: http://example.com/wp-content/plugins/my-plugin/includes/
will output: http://example.com/wp-content/plugins/my-plugin/includes/images/placeholder.png
will output: http://example.com/wp-content/plugins/my-plugin/images/placeholder.png