Hello,
I have a php error from a file shipped with the theme:
Warning: Invalid argument supplied for foreach() in ......./themes/mytheme/includes/wp_booster/td_wp_booster_functions.php on line 2212
The issue seems to be here :
//get our custom dynamic sidebars
$currentSidebars = td_util::get_option('sidebars');
//if we have user made sidebars, register them in wp
if (!empty($currentSidebars)) {
foreach ($currentSidebars as $sidebar) {
When executing a
//get our custom dynamic sidebars
$currentSidebars = td_util::get_option('sidebars');
var_dump($currentSidebars);
The result:
string(59) " M"
I cleared all transients without success.
Thanks for your help
Hello uper_nic0las,
Unfortunately, we do not have any bad reports in this regard, until now, sorry! Most likely you are using some untested plugins which can interact with the theme core file and cause a lot of unknown issues. Try to disable all of them, leave just Visual Composer to active, clear all your caches and check the results. Also, if the problem is still there, please try to make a new clean install from scratch via FTP way because this is the surest method in this regard.
Hope this helps and let us know how it goes!
Thanks for the message!
OK, I am using bedrock boilerplate https://roots.io/bedrock
and here are the plugin list :
+--------------------+----------+--------+---------+
| name | status | update | version |
+--------------------+----------+--------+---------+
| worker | inactive | none | 4.2.16 |
| revslider | active | none | 5.3.1.5 |
| td-mobile-plugin | active | none | 1.1 |
| td-social-counter | active | none | 4.1 |
| td-speed-booster | active | none | 4.5 |
| td-api-plugin | active | none | 1.0 |
| js_composer | active | none | 5.0.1 |
| wp-super-cache | active | none | 1.4.9 |
| bedrock-autoloader | must-use | none | 1.0.0 |
| disallow-indexing | must-use | none | 1.0.0 |
| 0-worker | must-use | none | |
+--------------------+----------+--------+---------+
Disabling all the plugins did not help.
And this error did show up only after playing with sidebar / widget.
Hello super_nic0las,
You should re-install the latest version of the theme via FTP way, use only the plugins that come bundled with the theme packet and rule out any conflicting plugins. I suggest you install the theme again via this way because this is the surest method in this regard. A bad theme installing can cause this type of issues and that’s why it is very important to make a new fresh install from scratch and check the results.
Hope this helps and let us know how it goes!
Thanks for the message!
I Instaledd WAMPSERVER on localhost, than installed WordPress, than Newspaper theme 7.7.1 than imported theme setings from my live site….
and BANG this error starts to happen….
Warning: Invalid argument supplied for foreach() in ......./themes/mytheme/includes/wp_booster/td_wp_booster_functions.php on line 2212
checked this forum for help, and found nothing… then somehow I remmebered to install a DEMO without sample data, as I did in live site…
and all errors just vanished…
Hope it helps…
And lot of people have the same problem as per google search results :
https://www.google.com/search?q=foreach()+in+%22td_wp_booster_functions.php%22+on+line+2212&*
-
This reply was modified 9 years by
super_nic0las.
@Tagdiv team, how about this fix ?
--- a/includes/wp_booster/td_wp_booster_functions.php
+++ b/includes/wp_booster/td_wp_booster_functions.php
@@ -2208,7 +2208,7 @@ function td_init_booster() {
$currentSidebars = td_util::get_option('sidebars');
//if we have user made sidebars, register them in wp
- if (!empty($currentSidebars)) {
+ if (is_array($currentSidebars)) {
foreach ($currentSidebars as $sidebar) {
register_sidebar(array(
'name' => $sidebar,
-
This reply was modified 9 years by
super_nic0las.
-
This reply was modified 9 years by
super_nic0las.
@Catalin, Exactly, we are runing wordpress under PHP version 7.1.1-1+deb.sury.org~trusty+1
Also, we are running it with Bedrock boilerplate https://roots.io/bedrock/
@MaNunes, thanks for the advice however we prefer to not take any risk by loading some demo settings that might brake a lot of customisation work that have already been done.
Note that another dirty way is to “hide” the error by turning off the error level in wordpress wp-settings :
define('WP_DEBUG', false);
Thanks all!
Nicolas
-
This reply was modified 9 years by
super_nic0las.
Hi @bogdan-b,
Thanks for the suggestion,
Just downgraded to PHP 7.0.17-2+deb.sury.org~trusty+1
and the problem still occurs.
Best.
-
This reply was modified 9 years by
super_nic0las.