Edit default image attachment size

you can try this function filter_ptags_on_images($content) { $content = preg_replace(‘/\s*()?\s*()\s*()?\s*/iU’, ‘\1\2\3’, $content); return preg_replace(‘/\s*(*.)\s*/iU’, ‘\1’, $content); } add_filter(‘the_content’, ‘filter_ptags_on_images’); this also has been solved here remove p tags from images

How to exclude an image size from the WordPress srcset

WordPress allows you to hook into wp_calculate_image_srcset See Core file on Trac This filter gives you 5 arguments: $sources One or more arrays of source data to include in the ‘srcset’ $size_array Array of width and height values in pixels (in that order). $image_src The ‘src’ of the image. $image_meta The image meta data as … Read more

Replacing image attributes (data-src) also applies to backend

Solution is simple, check that is_admin() returns false before doing any modifications to the content, or hook on admin_init to add you hooks. I don’t think that the_content is used in the context of admin, but thumbnail generation might be used. Another thing to keep in your mind is that those hooks might be triggered … Read more

How to Display Featured Image Title and ALT Attribute

Maybe following function is what you are looking for. The important part you are looking for in the code is the line which holds the pathinfo, which is php and not WordPress specific. There are probably several other options but as nobody responded till now I think that this function will help you out till … Read more