Created
November 11, 2014 10:24
-
-
Save milesstewart88/8a40e534fcdb95db07c5 to your computer and use it in GitHub Desktop.
Gets the plugin basename everytime without having to add a path.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_plugin_basepath() { | |
$path = explode("/", plugin_dir_path(__FILE__)); | |
$basePath = explode("/", plugin_basename(__FILE__)); | |
$pathKey = array_search($basePath[0], $path); | |
$newArray = array_slice(array_filter($path), 0, $pathKey); | |
$fullBasePath = implode("/", $newArray); | |
return "/" . $fullBasePath; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment