Skip to main content

Media file name

When I upload an image to Cloudflare R2, the filename is changed to fluentcom-somename-fluentcom.webp

If? or How can I change the prefix and suffix text “fluentcom”?

WiLson Eberechi

This is the original filter to use, edit it if you know how to code

add_filter('fluent_community/generated_upload_file_name', function ($file, $originalName, $file_3) {
    return $file;
}, 10, 3);

The below is an example I just created, it's a rough work, I just edited it now with my phone and I've not tested it, but it might work lol, use fluent snippet and paste the below code, save and activate and all your uploaded media will start with "community_"

add_filter('fluent_community/generated_upload_file_name', function ($file, $originalName, $file_3) {
    // Custom logic to prefix the original filename
    $file = 'community_' . $originalName; 
    return $file;
}, 10, 3);

Hope this works.