Skip to content

Instantly share code, notes, and snippets.

@lucas-pelton
Created March 19, 2020 19:23
Show Gist options
  • Save lucas-pelton/9cf3ab6cba523e57186c78571fbe8779 to your computer and use it in GitHub Desktop.
Save lucas-pelton/9cf3ab6cba523e57186c78571fbe8779 to your computer and use it in GitHub Desktop.
Create array of uploaded images in WP Media Library
// https://wordpress.stackexchange.com/questions/243697/zip-all-original-images-from-media-gallery
$query_images_args = array(
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_status' => 'inherit',
'posts_per_page' => - 1,
);
$query_images = new WP_Query( $query_images_args );
$images = array();
foreach ( $query_images->posts as $image ) {
$images[] = wp_get_attachment_url( $image->ID );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment