plugin_dir_url

Get the URL directory path (with trailing slash) for the plugin __FILE__ passed in.

Description

(string) plugin_dir_url( (string) $file ); 

Returns (string)

the URL path of the directory that contains the plugin.

Parameters (1)

0. $file (string)
The filename of the plugin (__FILE__).

Usage

  1. if ( !function_exists( 'plugin_dir_url' ) ) { 
  2. require_once ABSPATH . WPINC . '/plugin.php'; 
  3.  
  4. // The filename of the plugin (__FILE__). 
  5. $file = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = plugin_dir_url($file); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/plugin.php  
  1. function plugin_dir_url( $file ) { 
  2. return trailingslashit( plugins_url( '', $file ) );