post_gallery WordPress Filter Hook

This hook is used to insert a gallery of images into a post.

apply_filters( 'post_gallery', string $output, array $attr, int $instance ) #

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.

Top ↑

See also


Top ↑

Parameters

$output

(string)The gallery output. Default empty.

$attr

(array)Attributes of the gallery shortcode.

$instance

(int)Unique numeric ID of this gallery shortcode instance.


Top ↑

More Information

This filter allows plugins and themes to override the default gallery template (i.e. what the gallery shortcode returns).


Top ↑

Source

File: wp-includes/media.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.2.0The $instance parameter was added.
2.5.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