uploaded images don't appear in get_posts
-
Uploaded images don’t appear in get_posts, although I can see them in Media > uploaded to this page.
Here’s the code I’m using to loop:
global $post; if ( $images = get_posts(array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'image',))) { foreach( $images as $image ) {
The strangest thing is that it works on my localhost / Xampp site, but not on my production site. I tried removing bits, like the post_mime_type, but the only thing that retrieves anything is if I remove the ‘post_parent’ => $post->ID (I printed the $post->ID, it is available).
Post is published and visibility is public.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘uploaded images don't appear in get_posts’ is closed to new replies.