Title: Returns error
Last modified: August 21, 2016

---

# Returns error

 *  Resolved [pro01](https://wordpress.org/support/users/pro01/)
 * (@pro01)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/returns-error/)
 * In post view you get this:
 *     ```
       Warning: Invalid argument supplied for foreach() in /home/tiryakbg/public_html/speed/wp-content/plugins/post-attached-media-downloads/post-attached-media-downloads.php on line 354
       ```
   
 * Other than that it shows attachments.
 * [https://wordpress.org/plugins/post-attached-media-downloads/](https://wordpress.org/plugins/post-attached-media-downloads/)

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

 *  Plugin Author [Marius L. J.](https://wordpress.org/support/users/clorith/)
 * (@clorith)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/returns-error/#post-4761134)
 * Hi,
 * Thank you for the heads up, I just pushed 1.0.1 that fixes the warning output
   when files have yet to be attached in the post meta box!
 *  [a4nasko](https://wordpress.org/support/users/a4nasko/)
 * (@a4nasko)
 * [12 years ago](https://wordpress.org/support/topic/returns-error/#post-4761397)
 * Hey there!,
 * very handy plugin 😉
 * When integrated in my wp template for all pages I have same problem:
    _Warning:
   Invalid argument supplied for foreach() in /home/…/wp-content/plugins/post-attached-
   media-downloads/post-attached-media-downloads.php on line 378 _
 * when there is an attachment to the page everything is normal, but the pages without
   attachments has error message 🙁
 * **I use WordPress version 3.9.1 and Post Attached Media Downloads 1.1**
 *  [a4nasko](https://wordpress.org/support/users/a4nasko/)
 * (@a4nasko)
 * [12 years ago](https://wordpress.org/support/topic/returns-error/#post-4761398)
 * Мy solution for _Warning: Invalid argument supplied for foreach()_
    in plugin
   file post-attached-media-downloads.php
 *     ```
       if (is_array($entries))
                              {
       			foreach( $entries AS $entry ) {
       ```
   
 *  Plugin Author [Marius L. J.](https://wordpress.org/support/users/clorith/)
 * (@clorith)
 * [12 years ago](https://wordpress.org/support/topic/returns-error/#post-4761401)
 * hi [@a4nasko](https://wordpress.org/support/users/a4nasko/), sorry I didn’t see
   your post (ideally you should make a new post when one is marked as resolved 
   as I only saw your reply by chance).
 * I unfortunately didn’t see it before I released 1.2 today, but I pushed 1.2.1
   as a hotfix just now (will probably show up shortly) which addresses the issue
   you were having, and will always return false for the `get_downloads` function
   if there are no downloads found for a post (was also needed for the shortcode
   implementation, so thanks for spotting that!)

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

The topic ‘Returns error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/post-attached-media-downloads.svg)
 * [Post Attached Media Downloads](https://wordpress.org/plugins/post-attached-media-downloads/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-attached-media-downloads/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-attached-media-downloads/)
 * [Active Topics](https://wordpress.org/support/plugin/post-attached-media-downloads/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-attached-media-downloads/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-attached-media-downloads/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Marius L. J.](https://wordpress.org/support/users/clorith/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/returns-error/#post-4761401)
 * Status: resolved