This will allow you to rename an attachment as soon as its uploaded: add_action('add_attachment', 'rename_attachment'); function rename_attachment($post_ID){ $post = get_post($post_ID); $file = get_attached_file($post_ID); $path = pathinfo($file); //dirname = File Path //basename = Filename.Extension //extension = Extension //filename = Filename $newfilename = "NEW FILE NAME HERE"; $newfile = $path['dirname']."/".$newfilename.".".$path['extension']; rename($file, $newfile); update_attached_file( $post_ID, $newfile ); }