Make WordPress Core


Ignore:
Timestamp:
01/15/2016 09:38:30 AM (9 years ago)
Author:
swissspidy
Message:

Filesystem API: Add a filter to wp_unique_filename().

Props SergeyBiryukov, MikeHansenMe, johnbillion, swissspidy.
Fixes #19121.

File:
1 edited

Legend:

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

    r36274 r36310  
    20042004                $number = $new_number;
    20052005            }
    2006             return $filename2;
     2006
     2007            /**
     2008             * Filter the result when generating a unique file name.
     2009             *
     2010             * @since 4.5.0
     2011             *
     2012             * @param string        $filename                 Unique file name.
     2013             * @param string        $ext                      File extension, eg. ".png".
     2014             * @param string        $dir                      Directory path.
     2015             * @param callable|null $unique_filename_callback Callback function that generates the unique file name.
     2016             */
     2017            return apply_filters( 'wp_unique_filename', $filename2, $ext, $dir, $unique_filename_callback );
    20072018        }
    20082019
     
    20162027    }
    20172028
    2018     return $filename;
     2029    /** This filter is documented in wp-includes/functions.php */
     2030    return apply_filters( 'wp_unique_filename', $filename, $ext, $dir, $unique_filename_callback );
    20192031}
    20202032
Note: See TracChangeset for help on using the changeset viewer.