Make WordPress Core


Ignore:
Timestamp:
02/27/2015 04:50:14 PM (10 years ago)
Author:
wonderboymusic
Message:

Make a new function, wp_delete_file(). Use it.

Props scribu, wonderboymusic.
Fixes #17864.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r31554 r31575  
    48144814    return (bool) $var;
    48154815}
     4816
     4817/**
     4818 * Delete a file
     4819 *
     4820 * @since 4.2.0
     4821 *
     4822 * @param string $file The path to the file to delete.
     4823 */
     4824function wp_delete_file( $file ) {
     4825    /**
     4826     * Filter the path of the file to delete.
     4827     *
     4828     * @since 2.1.0
     4829     *
     4830     * @param string $medium Path to the file to delete.
     4831     */
     4832    $delete = apply_filters( 'wp_delete_file', $file );
     4833    if ( ! empty( $delete ) ) {
     4834        @unlink( $delete );
     4835    }
     4836}
Note: See TracChangeset for help on using the changeset viewer.