img_caption_shortcode_width WordPress Filter Hook
The img_caption_shortcode_width hook is used to override the width of an image caption shortcode. This can be useful for making sure that your image captions are a consistent width, or for making them narrower or wider depending on your needs.
apply_filters( 'img_caption_shortcode_width', int $width , array $atts , string $content ) #
Filters the width of an image’s caption.
Description
By default, the caption is 10 pixels greater than the width of the image, to prevent post content from running up against a floated image.
See also
Parameters
- $width
(int)Width of the caption in pixels. To remove this inline style, return zero.
- $atts
(array)Attributes of the caption shortcode.
- $content
(string)The image element, possibly wrapped in a hyperlink.
Source
File: wp-includes/media.php
Changelog
Version | Description |
---|---|
3.7.0 | Introduced. |