Should mfrh_new_filename return deterministic values?
-
There is a function bellow in the FAQ that we can use to customize file names. My question is if i can use rand() to generate a filename in this function?
Im asking because if this code is also used for something other than the generation the filename only ONCE before it is permanently written to db…for example to get the filename of the image multipel times in the same run …it would allways get a different value for the same image…
So in short should this function return a deterministic value or can i use rand() in this function to generate random image names?
add_filter( ‘mfrh_new_filename’, ‘my_filter_filename’, 10, 3 );
function my_filter_filename( $new, $old, $post ) {
return “renamed-” . $new;
}
The topic ‘Should mfrh_new_filename return deterministic values?’ is closed to new replies.