I used Flatsome theme and used UX Builder page. I have looked at the same posts but no answers. (Wordpress) enter image description here

Please, Help me

Warning: Invalid argument supplied for foreach() in /home/gami/web/****/public_html/wp-content/themes/***/functions.php on line 186

  • Have you looked at line 186? What's the value it's trying to iterate over? Have you looked at the lines from the other errors too?
    – Rup
    Commented Dec 18, 2019 at 23:39
  • Which version of WordPress is this? In 5.3.2 post.php line 1976 is in is_post_type_viewable, which I guess means get_post_type_object is returning a non-zero-not-null scalar. And that amp line calls is_post_type_viewable, yes.
    – Rup
    Commented Dec 18, 2019 at 23:46

2 Answers 2


It sounds like something (theme or plugin) has called a wordpress function and passed the wrong type of variable. In the first few notices Wordpress is expecting an object and has been passed something else. In the warning it is expecting an array and has been passed something else. Debug what is causing it, then tell the providers of theme / plugin. To debug one usually deactivates all (or suspected plugins) and maybe even swop to standard wp theme. Repeat action that causes messages. No message? good. Then switch back to theme. Repeat action, Activate one plugin, repeat action until you get the message back. The last reactivated is probably what caused it. Tell the developer.

It may be that they had not anticipated a certain situation, so until fixed, you may be able to work around the warning by avoiding the situation, changing the data etc.


Thanks you.

I turn off all Plugin. and turn on each plugin.

It seems that it conflicts with Plugin.

I fixed it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.