wordpress / latest / functions / _wp_check_alternate_file_names.html

_wp_check_alternate_file_names( string[] $filenames, string $dir, array $files ): bool

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Helper function to test if each of an array of file names could conflict with existing files.

Parameters

$filenames string[] Required
Array of file names to check.
$dir string Required
The directory containing the files.
$files array Required
An array of existing files in the directory. May be empty.

Return

bool True if the tested file name could match an existing file, false otherwise.

Source

File: wp-includes/functions.php. View all references

function _wp_check_alternate_file_names( $filenames, $dir, $files ) {
	foreach ( $filenames as $filename ) {
		if ( file_exists( $dir . $filename ) ) {
			return true;
		}

		if ( ! empty( $files ) && _wp_check_existing_file_names( $filename, $files ) ) {
			return true;
		}
	}

	return false;
}

Uses

Uses Description

Used By

Used By Description

Changelog

Version Description
5.8.1 Introduced.

© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_wp_check_alternate_file_names