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: 8 years ago #
  2. JJJ
    BuddyPress/bbPress Lead


    Add a ticket and file it as an enhancement request.

    Posted: 8 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: 8 years ago #
  4. Jim Robinson

    A ticket was created for this but nothing has been done with this in years: https://core.trac.wordpress.org/ticket/19121

    Posted: 2 years ago #

RSS feed for this topic


You must log in to post.

  • Rating

    9 Votes
  • Status

    This idea is under consideration