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
if ( !function_exists( 'plugin_dir_path' ) ) { require_once ABSPATH . WPINC . '/plugin.php'; } // The filename of the plugin (__FILE__). $file = ''; // NOTICE! Understand what this does before running. $result = plugin_dir_path($file);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/plugin.php
- function plugin_dir_path( $file ) {
- return trailingslashit( dirname( $file ) );
- }