Thanks for reporting this, @majecdad! I’ll have a look.
I am having the same problem. Any widget I use in my side bar now gives me this warning: Warning: Invalid argument supplied for foreach() in /home2/bluemoon/public_html/wp-content/plugins/widget-context/modules/custom-post-types-taxonomies/custom-cpt-tax.php on line 88
If I remove the widget the error message is gone, but I’d really like to use my side bar again.
Linda
Hello Kaspars,
Putting
if (!empty($this->post_types)) {
and
if (!empty($this->taxonomies)) {
removes the errors, but I am not sure this is the right approach.
Regards,
Spyros
Thanks for reporting this issue! It has been fixed in version 1.0.1.
Just as a doublecheck, this same error was outputting when I installed Woocommerce. I don’t have time to check for you, but it might be worthwhile just to doublecheck that the error doesn’t appear when installing Woocommerce (straight out of the box, no configuration). Thanks for the great update!
Excellent. Confirming it works properly for me with 1.0.1 (and on a site that has WooC 2.1 active also, so no problem there for me).
Thanks.
I am sorry to say that with Woocommerce installed and random products widget active the error is still there.
Thanks for the effort tho.
Regards,
Spyros
@spyrosvl are you running Widget Context 1.0.1?
Kaspars – thanks for responding on this thread and huge thanks for your plugin. I use it on loads of websites – it’s an essential tool for me.
I too am sorry to report that I have installed Widget Context 1.0.1 and Woocommerce 2.1.12 installed, as well as a few other plugins.
The same error is returned:
Warning: Invalid argument supplied for foreach() in /home/retromet/public_html/wp-content/plugins/widget-context/modules/custom-post-types-taxonomies/custom-cpt-tax.php on line 88
I actually have no CPT and Taxonmies selected in the Widget Context widget.
I have looked into the WooCommerce plugin source code and it looks like it is checking for widget existence before the main WordPress post query has run. This causes all widget visibility checks to report false visibility conditions.
I have updated the Widget Context plugin to make sure it runs only after the main post query has run. The update should go out in a few hours.
The plugin has been updated to 1.0.2, which should fix the issue with WooCommerce.