Image Guidelines Note in the Upload Screens
Shows a short note with your image rules, such as recommended sizes, file types and the need for alt text, right inside the media uploader and Media > Add New screen.
Opens WPIDE on
Code
// Guidance shown under the upload area.
$wpide_upload_guidance = '<strong>Before uploading:</strong> photos at least 1600px wide, under 500 KB, JPEG or WebP. Name files descriptively and always fill in the alt text.';
add_action( 'post-upload-ui', function () use ( $wpide_upload_guidance ) {
printf(
'<p class="wpide-upload-guidance" style="max-width:600px;margin:1em auto;padding:.75em 1em;background:#f0f6fc;border-left:4px solid #2271b1;text-align:left">%s</p>',
wp_kses( $wpide_upload_guidance, array( 'strong' => array(), 'em' => array(), 'a' => array( 'href' => true, 'target' => true ), 'br' => array() ) )
);
} );
Notes
Edit $wpide_upload_guidance; basic HTML such as strong and a links is allowed.
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.