Title: Warning: array_slice() expects parameter 1 to be array, null given&#8230;
Last modified: August 21, 2016

---

# Warning: array_slice() expects parameter 1 to be array, null given…

 *  [KimTasker](https://wordpress.org/support/users/kimtasker/)
 * (@kimtasker)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/warning-array_slice-expects-parameter-1-to-be-array-null-given/)
 * To those who may be experiencing this error, it seems it is caused by the news
   feed returned by google being empty.
    This could be due to a query returning 
   no results, or perhaps the connection to google news failing…
 * The thing is, this case should be protected in the plugin to return a nice message
   instead of a PHP error !
    Having the same issue in some cases, I simply put an`
   if ($feed)` condition on line 140 where the error appears :
 * `if ($feed) $items = array_slice($feed->items, 0, $atts['limit']);`
 * This prevents the plugin from returning the PHP error message, but that’s all.
   If you want a message to appear, like “Sorry, no news to display” or something
   of the sort, you’ll need to further customize.
    I you’re not comfortable with
   PHP or can’t figure out what do to here, I can provide some help if you’re interested.
 * I expect the plugin author to provide an update fixing this issue sooner or later
   😉
 * [http://wordpress.org/plugins/simple-google-news/](http://wordpress.org/plugins/simple-google-news/)

The topic ‘Warning: array_slice() expects parameter 1 to be array, null given…’ 
is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-google-news.svg)
 * [Simple Google News](https://wordpress.org/plugins/simple-google-news/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-google-news/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-google-news/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-google-news/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-google-news/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-google-news/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [KimTasker](https://wordpress.org/support/users/kimtasker/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/warning-array_slice-expects-parameter-1-to-be-array-null-given/)
 * Status: not resolved