Title: [Plugin: Yet Another Related Posts Plugin] Php Warning
Last modified: August 20, 2016

---

# [Plugin: Yet Another Related Posts Plugin] Php Warning

 *  Resolved [benoist](https://wordpress.org/support/users/benoist/)
 * (@benoist)
 * [14 years ago](https://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-php-warning/)
 * I have this : [04-May-2012 22:38:39 UTC] PHP Warning: Invalid argument supplied
   for foreach() in /home/nono/public_html/wp-content/plugins/yet-another-related-
   posts-plugin/class-cache.php on line 169
 * line 169 is :
    foreach ( $weight[‘tax’] as $tax => $weight ) {
 * Have you an idea ?
 * Regards
 * [http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/](http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/)

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

 *  [jwolfe-pgoa](https://wordpress.org/support/users/jwolfe-pgoa/)
 * (@jwolfe-pgoa)
 * [14 years ago](https://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-php-warning/#post-2729871)
 * I also noticed that today when I installed it. I changed the code around that
   statement to:
 *     ```
       // Build tax criteria query parts based on the weights
                       if ( is_array($weight['tax']) ) {
                       foreach ( $weight['tax'] as $tax => $weight ) {
                               $newsql .= " + " .$this->tax_criteria($reference_ID, $tax) . " * " . intval($weight);
                       }
                       }
       ```
   
 * Just to check if $weight[‘tax’] is an array before going into that loop.
 *  [mitcho (Michael Yoshitaka Erlewine)](https://wordpress.org/support/users/mitchoyoshitaka/)
 * (@mitchoyoshitaka)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-php-warning/#post-2729939)
 * I believe this is fixed in the latest dev build. Please let me know if it has
   not. Thanks!
 * [http://downloads.wordpress.org/plugin/yet-another-related-posts-plugin.zip](http://downloads.wordpress.org/plugin/yet-another-related-posts-plugin.zip)

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

The topic ‘[Plugin: Yet Another Related Posts Plugin] Php Warning’ is closed to 
new replies.

 * ![](https://ps.w.org/yet-another-related-posts-plugin/assets/icon-256x256.png?
   rev=2549977)
 * [YARPP - Yet Another Related Posts Plugin](https://wordpress.org/plugins/yet-another-related-posts-plugin/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yet-another-related-posts-plugin/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yet-another-related-posts-plugin/)
 * [Active Topics](https://wordpress.org/support/plugin/yet-another-related-posts-plugin/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yet-another-related-posts-plugin/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yet-another-related-posts-plugin/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [mitcho (Michael Yoshitaka Erlewine)](https://wordpress.org/support/users/mitchoyoshitaka/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-php-warning/#post-2729939)
 * Status: resolved