Add a filter to wp_unique_filename

  1. coldwinds


    function wp_unique_filename( $dir, $filename, $unique_filename_callback = null )


    function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
    	if ( empty( $name ) )
    		return array( 'error' => __( 'Empty filename' ) );
    	$wp_filetype = wp_check_filetype( $name );
    	if ( !$wp_filetype['ext'] )
    		return array( 'error' => __( 'Invalid file type' ) );
    	$upload = wp_upload_dir( $time );
    	if ( $upload['error'] !== false )
    		return $upload;
    ***=>	$filename = wp_unique_filename( $upload['path'], $name );

    There is no way to use custom wp_unique_filename generator @ function wp_upload_bits

    Posted: 5 years ago #
  2. http://core.trac.wordpress.org

    Add a ticket and file it as an enhancement request.

    Posted: 5 years ago #
  3. Jen
    Community Organizer

    @coldwinds: You were right to ost this in Ideas rather than on Trac, as ideas for core are meant to be discussed here and added to Trac only when it's been decided that they belong there. However, you should include an intro to the code to describe what you are proposing and why, to make it easier to scan the forum threads.

    @John James Jacoby: The only time someone should go to Trac to propose a change rather than the Ideas forum is if it is a bug ticket. All enhancements and feature requests are meant to be discussed here first, and moved to Trac when it's been determined by the core team that they should be implemented.

    Posted: 5 years ago #

RSS feed for this topic


You must log in to post.

  • Rating

    8 Votes
  • Status

    This idea is under consideration