Make alt text required when setting a featured image

In the EU it will shortly be a requirement for public sector websites to have alt text for uploaded images. My organisation's users are rubbish at adding alt text, however, and I'm trying to find a way to force them to do so.

The only way I've come across so far is to automatically fill the alt text with the image's title - which is not great if an image is called "shutterstock_45363627" - and could encourage laziness.

Ways I can think of making them type something:

(1) Set the 'Alt text' field to 'required' through the functions.php file - (though I read default fields can't be changed through attachment_fields_to_edit, for example).

(2) Find the "Attachment details" file in wp-admin and add a "required" attribute to the field. Which is awful, but might work.

(3) Use a WordPress hook to check that the alt text is filled in when setting an image... Or check that the alt text contains a space, since it should be a couple of words.

However, despite hours of googling, I can't find anything online on how to do any of these. Does anyone have suggestions?

Topic attachment-fields-to-edit accessibility attachments images Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.