Last active
May 28, 2017 14:30
-
-
Save hearvox/b5f3b70bcb92170ff091486224c9a2ad to your computer and use it in GitHub Desktop.
List GUIDs of all attachments in WordPress Media Library, limited by mime-type, e.g, PDFs only.
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
<?php | |
/* List GUIDs of all files of specified mime-type in Media Library. */ | |
$query_images_args = array( | |
'post_type' => 'attachment', | |
'post_status' => 'inherit', | |
'post_mime_type' => 'application/pdf', // Only PDFs. | |
'posts_per_page' => -1, | |
); | |
$query_images = new WP_Query( $query_images_args ); | |
print_r( wp_list_pluck( $query_images->posts, 'guid' ) ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment