Languages: English • 日本語 (Add your language)
Gets the path to a plugin file or directory, relative to the plugins directory, without the leading and trailing slashes.
<?php plugin_basename( $file ); ?>
If your plugin file is located at /home/www/wp-content/plugins/my-plugin/my-plugin.php, and you call:
$x = plugin_basename( __FILE__ );
The $x variable will equal to "my-plugin/my-plugin.php".
plugin_basename() is located in wp-includes/plugin.php
.
Plugin paths: plugins_url(), plugin_dir_url(), plugin_dir_path(), plugin_basename()
WordPress Directories: | ||
---|---|---|
home_url() | Home URL | http://www.example.com |
site_url() | Site directory URL | http://www.example.com or http://www.example.com/wordpress |
admin_url() | Admin directory URL | http://www.example.com/wp-admin |
includes_url() | Includes directory URL | http://www.example.com/wp-includes |
content_url() | Content directory URL | http://www.example.com/wp-content |
plugins_url() | Plugins directory URL | http://www.example.com/wp-content/plugins |
theme_url() | Themes directory URL (#18302) | http://www.example.com/wp-content/themes |
wp_upload_dir() | Upload directory URL (returns an array) | http://www.example.com/wp-content/uploads |