Created
January 5, 2019 08:56
-
-
Save Tsunamijaan/bcdb86d6abf03841ff56af11cd3f187b to your computer and use it in GitHub Desktop.
Remove width & height from images in posts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'post_thumbnail_html', 'remove_wps_width_attribute', 10 ); | |
| add_filter( 'image_send_to_editor', 'remove_wps_width_attribute', 10 ); | |
| function remove_wps_width_attribute( $html ) { | |
| $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html ); | |
| return $html; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment