Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Get all images from media library WordPress
<?php
$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