Warning: Invalid argument supplied for foreach() in post.php [closed]

In WordPress 4.5.3, there’s a foreach in wp-includes/post.php on line 1177 and no others around it, so I’m guessing this is the one that’s triggering the error in your install on line 1172.

This is inside the register_post_type() function, and it’s looping through the taxonomies argument that you’re sending through. Well… that you were meant to send through 😉

Your taxonomies argument is set to false, whereas register_post_type() says that only an array is a suitable value for this argument. This is why the foreach is erroring out.

So…. with all that said, set taxonomies to array() if you don’t want to have any taxonomies set. Or, you can just leave the argument out completely, and the default of array() will apply.

Now you know how to hunt through the error messages to hopefully find the issue in future 🙂 Also, as Mark Kaplun mentioned in the comments, make sure WP_DEBUG is set to true in wp-config.php on your development server; this way you will catch it from the start (then turn it off on your production server).

Also, it’s always a good idea to double check the docs of the function you’re calling so you know you’re sending through parameters in the correct format. You can start your search at https://developer.wordpress.org/reference/