plugin_dir_path

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

Description

(string) plugin_dir_path( (string) $file ); 

Returns (string)

the filesystem 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_path' ) ) { 
  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_path($file); 
  9.  

Defined (1)

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

/wp-includes/plugin.php  
  1. function plugin_dir_path( $file ) { 
  2. return trailingslashit( dirname( $file ) );