0

Is there a way to fetch the URLs and captions of all images attached to page x?

1

1 Answer 1

2
$is = get_children("post_parent=$id&post_type=attachment&post_mime_type=image");
foreach($is as $i) {
  $url = wp_get_attachment_image_src($i->ID, 'full');
  $caption = $i->post_title);
}

$id is the id of your post. See http://codex.wordpress.org/Function_Reference/get_children

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.