Getting Media Library attachment caption text
-
I can get my media library image URLs loaded into my $photo_urls array, but I can’t find the function/method to get my image captions text loaded into my $captions array. Can someone complete my last line of code?
$media_query = new WP_Query(
array(
‘post_type’ => ‘attachment’,
‘post_status’ => ‘inherit’,
‘posts_per_page’ => -1
)
);
$photo_urls = array();
$captions = array();
foreach ($media_query->posts as $post) {
$photo_urls[] = wp_get_attachment_url($post->ID);
$captions[] = ??????????????
}
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Getting Media Library attachment caption text’ is closed to new replies.