Looked everywhere with no luck. How can I, using a function, assign a picture in my media library as a Featured Image for a post by matching their keywords?

In other words: We post an article. We compare the keywords found in the title and look for images in the library that share the same keywords within it's filename. We then show a random, unused image (not used for the last 7 days) as its featured image automatically.

There are plugins that come close, like Magic Post Thumbnail, but they match external images to posts. I simply want to match my own internal images to posts (we have photographers that send us raw images, we then rename them and have to match them to our content). Any functions, scripts or modifications to plugins would be amazing from you WP Masters out there :)

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.