Highlight Empty Alt Text Fields in the Media Modal
Outlines the Alternative Text field in red when it is empty in the media library and media modal, so authors notice it before inserting an image.
Opens WPIDE on
Code
.attachment-details .setting.alt-text textarea:placeholder-shown,
.attachment-details [data-setting="alt"] textarea:placeholder-shown,
#attachment_alt:placeholder-shown {
border: 2px solid #d63638 !important;
background: #fcf0f1 !important;
}
.attachment-details [data-setting="alt"] .name::after,
.setting.alt-text .name::after {
content: " (needed)";
color: #d63638;
font-weight: 600;
}
Notes
Pure CSS; it reminds but does not block inserting images.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.