Is it possible to make an admin column in the media library that will indicate whether or not an image is used somewhere as a 'featured image'?

  • 2
    It's probably possible in theory, but since featured images are stored as postmeta, querying your whole postmeta table for all of the featured images and then matching up the IDs is likely to be a very expensive query. If you only need future ones rather than existing featured images, you could probably hook into save_post or something similar to check whether there's a featured image, and at that point save a custom "featured image" taxonomy just set to "true" for that image ID. That way you could do a tax query in the Media Library, which would perform much faster.
    – WebElaine
    Jan 20, 2022 at 20:54
  • Thank you WebElaine. I hadn't thought it would use so many resources for the page! I'll try to implement your second method.
    – imagina
    Jan 20, 2022 at 23:49


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.