Uploaded images don’t show in Media Library if there are special characters in IPTC Keywords

I have tested this with an image I created myself with Photoshop where I inserted the word “Süss” in every thinkable IPTC field. I uploaded it to my WordPress 4.6 installation, which has no image handling plugins installed. The uploading went smoothly, the right thumbnails were created in the uploads directory and the caption field … Read more

How to insert pictures without hard coded dimensions?

I don’t know if this is the best way to do this, but it works for me. In the functions.php of the theme you are using, put this: function remove_img_src($html) { $html = preg_replace(‘@(width|height)=”([0-9])+” ?@i’, ”, $html); return $html; } add_filter(‘image_send_to_editor’, ‘remove_img_src’, 10, 8); It uses regular expresions to change the output that is inserted … Read more

How to change image type for specific size?

You can use the wp_generate_attachment_metadata filter: function wpse_183835_to_jpeg( $meta, $post_id ) { $sizes_to_convert = array( ‘thumbnail’, ); $path = dirname( get_attached_file( $post_id ) ); foreach ( $sizes_to_convert as $size ) { if ( ! empty( $meta[‘sizes’][ $size ] ) ) { $data = $meta[‘sizes’][ $size ]; if ( $data[‘mime-type’] === ‘image/png’ && is_file( $file = … Read more

Retrieve featured image

The featured image attachment id is stored in the post_meta table, with the meta_key _thumbnail_id. Use that post id to find the post meta with meta_key _wp_attachment_metadata. The value of that is a serialized array with keys thumb, file, width, height, sizes (an array), and image_meta (an array). The file value is relative to the … Read more

Prevent WordPress from adding image’ title automatically

You can try the following to clear the image attachment’s title when it’s inserted but not updated: /** * Empty the image attachment’s title only when inserted not updated */ add_filter( ‘wp_insert_attachment_data’, function( $data, $postarr ) { if( empty( $postarr[‘ID’] ) && isset( $postarr[‘post_mime_type’] ) && wp_match_mime_types( ‘image’, $postarr[‘post_mime_type’] ) ) $data[‘post_title’] = ”; return … Read more

WP 4.4. responsive images browser choosing the “wrong” one

Concerning documentation there is this blog post on the Make Blog: Responsive Images in WordPress 4.4 To increase the 1600px limit mentioned in the comments try this: add_filter(‘max_srcset_image_width’, function($max_srcset_image_width, $size_array){ return 2000; }, 10, 2); Finally as already mentioned you should fix your calls to add_image_size add_image_size(‘news-large’, 1024, false); needs to be add_image_size(‘news-large’, 1024, 0, … Read more