I'm a content manager and want to make sure that all images uploaded by my writers onto WordPress are in JPEG format, rather than PNG as this slows the site down. Is there a way for me to check the nature of the file type as an administrator?
I'm a content manager and want to make sure that all images uploaded by my writers onto WordPress are in JPEG format, rather than PNG as this slows the site down. Is there a way for me to check the nature of the file type as an administrator?
Share Improve this question edited Mar 2, 2020 at 21:14 Tom J Nowell♦ 61k7 gold badges79 silver badges148 bronze badges asked Mar 2, 2020 at 18:38 Amy EvansAmy Evans 211 silver badge2 bronze badges 1- Why only Jpegs? Is this because PNGs have larger filesizes? Why not ask how to limit the filesizes of images uploaded? Or how to convert PNG files into JPEG on upload? A well crafted PNG can be much smaller than the equivalent JPEG if done right – Tom J Nowell ♦ Commented Mar 2, 2020 at 21:13
1 Answer
Reset to default 5First off, PNGs do not necessarily slow your site down anymore than a JPG. It all depends on how the image is saved or optimized and the file size. Anyway.
You have a couple options. Since this site is about coding and we don't support 3rd party plugins I will give you this first.
You can filter the file types the WordPress allows by using upload_mimes. Here is an example of allowing only JPG images.
function wpse_restrict_mimes($mime_types){
$mime_types = array(
'jpg|jpeg' => 'image/jpeg'
);
return $mime_types;
}
add_filter('upload_mimes', 'wpse_restrict_mimes');
Now if someone tries to upload anything other than a JPG they will get a message like this...
This code would go in your theme or better yet Child Theme's functions.php file. Keep in mind it will effect the entire site.
You mentioned being a content manager, if your not comfortable with code their are plugins out there that will do this for you. I would suggest using Google to find a couple, read the reviews and make sure the plugin is up-to-date. Something LIKE THIS looks like it may work.