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.

Top ↑

See also


Top ↑

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.


Top ↑

Source

File: wp-includes/media.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
3.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More