get_post_galleries_images() WordPress Function

The get_post_galleries_images() function enables you to retrieve all images associated with a post, including images from any galleries attached to the post. This function can be used in your template files to output the images in a post gallery.

get_post_galleries_images( int|WP_Post $post ) #

Retrieve the image srcs from galleries from a post’s content, if present


Description

Top ↑

See also


Top ↑

Parameters

$post

(int|WP_Post)(Optional) Post ID or WP_Post object. Default is global $post.


Top ↑

Return

(array) A list of lists, each containing image srcs parsed. from an expanded shortcode


Top ↑

Source

File: wp-includes/media.php

function get_post_galleries_images( $post = 0 ) {
	$galleries = get_post_galleries( $post, false );
	return wp_list_pluck( $galleries, 'src' );
}


Top ↑

Changelog

Changelog
VersionDescription
3.6.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