Hook for saving an image after editing

wp_save_image_editor_file filter fires after. add_filter( ‘wp_save_image_editor_file’, ‘custom_wp_save_image_editor_file’, 10, 5 ); function custom_wp_save_image_editor_file( $saved, $filename, $image, $mime_type, $post_id ){ //Your logic here return $saved; }

How do I create Comma Separated list of attached image ids?

You can try this one-liner, within the loop, instead of all your above code: $ids = join( ‘,’, wp_list_pluck( get_attached_media(‘image’ ), ‘ID’ ) ); where we pluck out the ID’s from the get_attached_media() output. Another approach would be to use: $ids = join( ‘,’, get_attached_media( ‘_image_ids’ ) ); where we’ve introduced a new input parameter … Read more

How to force WordPress to add new images at the beginning of the gallery?

I just fixed this after several hours of research. If one need to do the same thing, he must edit file wp-includes\js\media-views.js and replace add with unshift in this line (#2611, galleryAddToolbar): edit.get(‘library’).add( state.get(‘selection’).models ); So the code will look like this: edit.get(‘library’).unshift( state.get(‘selection’).models ); After that when you add images in the gallery they … Read more

Thumbnail with different sizes

Intermediate image sizes are discrete, not variable. When you define an image size, with specific dimensions (whether hard-cropped or box-resized), WordPress will create a discrete image, with the specified dimensions. Otherwise, if width could be defined dynamically, WordPress would have to create a prohibitively large number of images, just to account for responsiveness. To account … Read more