Warning: key() expects parameter 1 to be array, string given in ../settings/Text
-
This is relate to an old question (Error in Settings – Tab TEXT) that even if is marked as resolved it was not.
Finally I got some extra time and found what caused the error, and also fixed it.
The error appeared in SportsPress settings – Text and it was the following
Warning: key() expects parameter 1 to be array, string given in /web/htdocs/www.basketbattaglia.com/home/wp-content/plugins/sportspress/includes/admin/class-sp-admin-settings.php on line 182
Here’s a screenshot of the error
After more investigation I’ve discovered that if any words contains special chars it raises the error. In my case was the Italian translation of Nationality, that is Nazionalità, and the function parsed it as follows
Array ( [sportspress_text_Nazionalit] => [#224;]] => ) Warning: key() expects parameter 1 to be array, string given in /web/htdocs/www.basketbattaglia.com/home/wp-content/plugins/sportspress/includes/admin/class-sp-admin-settings.php on line 182
My fix was this:
Open
wp-content/plugins/sportspress/includes/admin/class-sp-admin-settings.php
find line 174
parse_str( $option_name, $option_array );
replace with
parse_str( urlencode( $option_name ), $option_array );
save the file.My error now is fixed
- The topic ‘Warning: key() expects parameter 1 to be array, string given in ../settings/Text’ is closed to new replies.