Featured images get shrunken

Hey if you want to add custom image size then add the following code in your function.php file add_image_size( ‘thumb’, 220, 180, true ); and then call featured image in your template like this <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail(‘thumb’); } ?> … Read more

How to change compression of WordPress uploads including original image

For compressing the uploaded image I wrote a simple code snippet that immediately overwrites a newly uploaded file with an image whose quality can be specified: function wt_handle_upload_callback( $data ) { $image_quality = 30; // Change this according to your needs $file_path = $data[‘file’]; $image = false; switch ( $data[‘type’] ) { case ‘image/jpeg’: { … Read more

Add instructions For Media Library Uploads

Here are two examples using the pre-upload-ui and post-upload-ui hooks: add_action( ‘pre-upload-ui’, function() { ?><h4> <?php esc_html_e( ‘Please Remember This And That! (pre-upload-ui)’, ‘wpse’ );?> </h4> <?php }); add_action( ‘post-upload-ui’, function() { ?><h4> <?php esc_html_e( ‘Please Remember This And That! (post-upload-ui)’, ‘wpse’ );?> </h4> <?php }); You might want to adjust this further to follow … Read more

Replacing Images in Media Library

Well, I think the easiest way would be the following: Download your wp-content/uploads/ folder so you have all images on your hard disk Remove the images WordPress has automatically generated (the ones with -*x*.jpg, maybe read this if you have SSH access as a filename) Optimize your base images with Photoshop Reupload the images into … Read more

Cannot upload .mp3 file to wordpress media

you need to allow them to be uploaded in your media files. you can add following code to your themes functions.php function my_mime_types($mime_types){ $mime_types[‘mp3’] = ‘audio/mpeg’; return $mime_types; } add_filter(‘upload_mimes’, ‘my_mime_types’, 1, 1); there is more information about adding new mime types in WP here: https://wpsmackdown.com/add-remove-filetypes-wordpress-media-library/#add-filetypes And here a list of the mime_types: https://feedforall.com/mime-types.htm