上载的文件在WordPress中存储为附件帖子类型。使用get_posts() 并查询所有附件:
$args = array(
    \'post_type\' => \'attachment\',
    \'numberposts\' => -1,
    \'post_status\' => null,
    \'post_parent\' => null ); 
$all_attachments = get_posts( $args );
 编辑-也可以设置
post_mime_type 例如,在get\\u posts中获取所有类型的“image/jpeg”。