apply_filters( 'post_gallery', string $output, array $attr, int $instance )
- Since
- 2.5.0, 4.2.0
Filters the default gallery shortcode output.
Description
If the filtered output isn't empty, it will be used instead of generating the default gallery template.
Compatibility
- WordPress
- since 4.2.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$outputstring- The gallery output. Default empty.
$attrarray- Attributes of the gallery shortcode.
$instanceint- Unique numeric ID of this gallery shortcode instance.
Where this hook fires · 1
wp-includes/media.php:2857gallery_shortcode()
Source code
* @see gallery_shortcode() * * @param string $output The gallery output. Default empty. * @param array $attr Attributes of the gallery shortcode. * @param int $instance Unique numeric ID of this gallery shortcode instance. */ $output = apply_filters( 'post_gallery', '', $attr, $instance ); if ( ! empty( $output ) ) { return $output; } $html5 = current_theme_supports( 'html5', 'gallery' );Changelog
Introduced in 2.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
4.2.0
The
$instance parameter was added.from the docblock2.5.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.