Reply To: how can I write a custom string in functions.php?

#100055
Pablo Pacheco
Participant

Hi,

First, you have to create a custom rule in the filename structure option using curly braces, like {my_custom_rule}. You just have to write it, in any position you want.

Then you can use the filter frou_sanitize_file_name to create a custom function. For example, if you want to add the user id it would be something like this:

add_filter( 'frou_sanitize_file_name', function($filename_infs){
    $filename_infs['structure']['translation']['my_custom_rule'] = get_current_user_id();
    return $filename_infs;
}, 20 );