Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

pixelkai on "Remove thumbnail dimensions from wp_caption"

$
0
0

i am using the following code in functions.php to get rid of the inline thumbnail dimensions generated by wordpress :)

// Remove inline width and height added to images
function remove_thumbnail_dimensions( $html ) { $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html ); return $html; }
add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 );
add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 );
// Removes attached image sizes as well
add_filter( 'the_content', 'remove_thumbnail_dimensions', 10 );

this works fine excepted for images which are added through wp_captions shortcode :(

so i thought i just add another filter
add_filter( 'img_caption_shortcode', 'remove_thumbnail_dimensions', 10 );

but for some reason it willl not work :(


Viewing all articles
Browse latest Browse all 8245

Trending Articles