Created
March 19, 2020 19:23
-
-
Save lucas-pelton/9cf3ab6cba523e57186c78571fbe8779 to your computer and use it in GitHub Desktop.
Create array of uploaded images in WP Media Library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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