wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_delete_file_from_directory › WordPress Function
Seit4.9.7
Veraltetn/v
› wp_delete_file_from_directory ( $file, $directory )
Parameter: (2) |
|
Gibt zurück: |
|
Definiert in: |
|
Codex: |
Deletes a file if its path is within the given directory.
Ähnliche Funktionen: _wp_filter_font_directory, wp_delete_file, wp_delete_category, wp_delete_comment, _wp_get_image_size_from_meta
Quellcode
function wp_delete_file_from_directory( $file, $directory ) { if ( wp_is_stream( $file ) ) { $real_file = $file; $real_directory = $directory; } else { $real_file = realpath( wp_normalize_path( $file ) ); $real_directory = realpath( wp_normalize_path( $directory ) ); } if ( false !== $real_file ) { $real_file = wp_normalize_path( $real_file ); } if ( false !== $real_directory ) { $real_directory = wp_normalize_path( $real_directory ); } if ( false === $real_file || false === $real_directory || ! str_starts_with( $real_file, trailingslashit( $real_directory ) ) ) { return false; } return wp_delete_file( $file ); }