Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to hook into the media upload function and prefix file names with a timestamp. We're uploading a lot of stuff within a month, so we can't rely on the directory structure, and we're also dealing with a bunch of teenagers, so I'm looking for a step around the user.

Anyone have a solution?

share|improve this question
add comment

1 Answer

add a filter to sanitize_file_name:

function wpse27657_filename_filter($name) {
    return time().$name;
}
add_filter('sanitize_file_name', 'wpse27657_filename_filter', 10);
share|improve this answer
    
Yes! Thank you so much. This is perfect. –  zack Sep 4 '11 at 5:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.