_wp_check_alternate_file_names()
Helper function to test if each of an array of file names could conflict with existing files.
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Return
true|false
. True if the tested file name could match an existing file, false otherwise.
Usage
_wp_check_alternate_file_names( $filenames, $dir, $files );
- $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.
Changelog
Since 5.8.1 | Introduced. |
_wp_check_alternate_file_names() wp check alternate file names code WP 6.5.2
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; }