WordPress at a glance
function is not described


Path_Processor::find_absolute_plugin_path() private WC 1.0

Given a file and a list of directories to check, this method will try to figure out the absolute path to the file in question.

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

No Hooks.


String|null. The absolute path to the plugin file, otherwise null.


// private - for code of main (parent) class only
$result = $this->find_absolute_plugin_path( $normalized_path, $directories_to_check );
$normalized_path(string) (required)
The normalized path to the plugin or theme file to resolve.
$directories_to_check(array) (required)
The directories we should check for the file if it isn't an absolute path.

Code of Path_Processor::find_absolute_plugin_path() WC 5.2.2

private function find_absolute_plugin_path( $normalized_path, $directories_to_check ) {
	// We're only able to find the absolute path for plugin/theme PHP files.
	if ( ! is_string( $normalized_path ) || '.php' !== substr( $normalized_path, -4 ) ) {
		return null;

	foreach ( $directories_to_check as $directory ) {
		$normalized_check = wp_normalize_path( trailingslashit( $directory ) ) . $normalized_path;
		// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
		if ( @is_file( $normalized_check ) ) {
			return $normalized_check;

	return null;