WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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

Your Answer


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.