Focus on cloud service provider activities
Notes on website operation and maintenance

Batch processing of the height and width limit of pictures uploaded by WordPress

By default, WordPress images will have a set size when we send them. But sometimes we want to change the width and height. We can remove them in batches.

 // By laozuo.org      add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 ); add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 ); function remove_width_attribute( $html ) { $html = preg_replace( '/(width|height)="\d*"\s/', "", $html ); return $html; }

 

Vote for you
Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » Batch processing of the height and width limit of pictures uploaded by WordPress