Title: Not loading any attachments
Last modified: March 23, 2023

---

# Not loading any attachments

 *  Resolved [sunofjuche](https://wordpress.org/support/users/sunofjuche/)
 * (@sunofjuche)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/not-loading-any-attachments/)
 * Hello, recently I’ve set up the plugin and wanted to use it for loading images
   from my media library. However, I just can’t get it to load any attachments, 
   i. e. media, or images, while it still perfectly loads regular posts. See, this
   shortcode works, but it will only load posts, not attachments:
 *     ```wp-block-code
       [ajax_load_more post_type="any" posts_per_page="5"]
       ```
   
 * And if I try applying filters like this:
 *     ```wp-block-code
       [ajax_load_more post_type="attachment" posts_per_page="5" no_results_text="No results"]
       ```
   
 * or this, where I apply custom field “presentation” that I’ve set for some of 
   my attachments:
 *     ```wp-block-code
       [ajax_load_more acf="true" acf_field_type="relationship" acf_field_name="presentation" posts_per_page="5" no_results_text="No results"]
       ```
   
 * it simply refuses to load anything. I’m using the default repeater template. 
   Any help appreciated!

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/not-loading-any-attachments/#post-16588587)
 * Hi [@sunofjuche](https://wordpress.org/support/users/sunofjuche/) 
   Attachments
   are tricky… here is an example that loads attachments from a specific post.[https://connekthq.com/plugins/ajax-load-more/examples/attachments/](https://connekthq.com/plugins/ajax-load-more/examples/attachments/)
 * You can also use the [ACF extension](https://connekthq.com/plugins/ajax-load-more/extensions/advanced-custom-fields/)
   and an ACF Gallery.
   [https://connekthq.com/plugins/ajax-load-more/examples/advanced-custom-fields/gallery/](https://connekthq.com/plugins/ajax-load-more/examples/advanced-custom-fields/gallery/)
 * Hope this gets you pointed in the right direction.
 *  Thread Starter [sunofjuche](https://wordpress.org/support/users/sunofjuche/)
 * (@sunofjuche)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/not-loading-any-attachments/#post-16588601)
 * Thank you, I’ve already checked everything out. Unfortunatelly, I’m not eager
   to use ACF premium at the moment, so no way to use the Gallery. So, is it safe
   to say that the only way for me to load attachments is to have them attached 
   to specific posts, and no other option available?
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/not-loading-any-attachments/#post-16588612)
 * That’s the only way I’ve found it possible.
 * If you find a way (google etc) using a `WP_Query` it would be possible using 
   this plugin. I’d just need to see the working code and could get it working.
 *  Thread Starter [sunofjuche](https://wordpress.org/support/users/sunofjuche/)
 * (@sunofjuche)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/not-loading-any-attachments/#post-16588623)
 * Alright, I see. Thanks for quick answer!
 *  Thread Starter [sunofjuche](https://wordpress.org/support/users/sunofjuche/)
 * (@sunofjuche)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/not-loading-any-attachments/#post-16588841)
 * Hey, this query works for me:
 *     ```wp-block-code
       $query = new WP_Query();
       $posts = $query->query(array('post_status' => 'inherit', 'post_type'=> 'attachment', 'post_mime_type' => 'image/jpeg,image/gif,image/jpg,image/png'));
       ```
   
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/not-loading-any-attachments/#post-16588864)
 * Ok, I assumed you already tried that.
 * Those params are set here. I’m just specifying a post parent in my example.
   [https://connekthq.com/plugins/ajax-load-more/examples/attachments/#shortcode](https://connekthq.com/plugins/ajax-load-more/examples/attachments/#shortcode)

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Not loading any attachments’ is closed to new replies.

 * ![](https://ps.w.org/ajax-load-more/assets/icon-256x256.png?rev=2944639)
 * [Ajax Load More – Infinite Scroll, Load More, & Lazy Load](https://wordpress.org/plugins/ajax-load-more/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-load-more/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-load-more/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-load-more/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-load-more/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-load-more/reviews/)

## Tags

 * [images](https://wordpress.org/support/topic-tag/images/)
 * [media](https://wordpress.org/support/topic-tag/media/)

 * 6 replies
 * 2 participants
 * Last reply from: [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/not-loading-any-attachments/#post-16588864)
 * Status: resolved