WordPress at a glance
function is not described


Plugin_Locator::find_current_plugin() public WC 1.0

Finds the path to the current plugin.

{} It's a method of the class: Plugin_Locator{}

No Hooks.


String. $path The path to the current plugin.


$Plugin_Locator = new Plugin_Locator();

Code of Plugin_Locator::find_current_plugin() WC 5.3.0

public function find_current_plugin() {
	// Escape from `vendor/__DIR__` to root plugin directory.
	$plugin_directory = dirname( dirname( __DIR__ ) );

	// Use the path processor to ensure that this is an autoloader we're referencing.
	$path = $this->path_processor->find_directory_with_autoloader( $plugin_directory, array() );
	if ( false === $path ) {
		throw new \RuntimeException( 'Failed to locate plugin ' . $plugin_directory );

	return $path;