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 anif ($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 ??
- The topic ‘Warning: array_slice() expects parameter 1 to be array, null given…’ is closed to new replies.