ページで使用されているすべての画像を取得したい。これは私が使用しているコードです:
function get_page_images($id) {
    $photos = get_children( array(
        'post_parent' => $id,
        'post_status' => 'inherit',
        'post_type' => 'attachment',
        'post_mime_type' => 'image',
        'order' => 'ASC',
        'orderby' => 'menu_order ID') );
    $results = array();
    if ($photos) {
        foreach ($photos as $photo) {
            // get the correct image html for the selected size
            $results[] = wp_get_attachment_image($photo->ID, $size);
        }
    }
    return $results;
}
これは、このページ専用にアップロードされた画像のみを取得します。以前に別のページ/投稿にアップロードされた画像を再利用した場合、それらは取得されません (アップロード先の投稿に添付されているため、投稿は取得されません)で再利用されます)。ページ/投稿で使用されているすべての画像を取得する方法を知っている人はいますか?