1

I'm trying to replace some icons for files in the media library based on the file-name / file-path. I want to give each file that contains the filename "example-name" a different icon in the media library.

I have no idea where to start, if someone can help me on track I'll happilly post the finished solution here, cause on the whole internet I couldn't find any.

pseudo-code

<?php foreach ($mediaFiles as $mediaFile) {
    if (strstr($mediaFile['path'], 'example-name')) $mediaFile['icon'] = 'custom-icon.jpg';
} ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.