Snippets: How to use post image attachments for gallery slider

add_filter( 'wpex_get_post_gallery_ids', function( $ids ) {
	$images = get_attached_media( 'image' );
	if ( $images ) {
		$ids = array(); // reset incase there are any defined gallery images lets not include them
		foreach ( $images as $image ) {
			$ids[] = $image->ID;
		}
	}
	return $ids;
} );

Version Required:4.8.5+

Snippet Type: PHP

All PHP snippets should be added via a child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)