get_post_gallery( int|WP_Post $post, bool $html = true )
Check a specified post’s content for gallery and, if present, return the first
Parameters
Return
(string|array) Gallery data and srcs parsed from the expanded shortcode.
Source
File: wp-includes/media.php
function get_post_gallery( $post = 0, $html = true ) {
$galleries = get_post_galleries( $post, $html );
$gallery = reset( $galleries );
/**
* Filters the first-found post gallery.
*
* @since WP-3.6.0
*
* @param array $gallery The first-found post gallery.
* @param int|WP_Post $post Post ID or object.
* @param array $galleries Associative array of all found post galleries.
*/
return apply_filters( 'get_post_gallery', $gallery, $post, $galleries );
}
Changelog
Version | Description |
---|---|
WP-3.6.0 | Introduced. |