I was having a similar error when using a WP_Query as given at
https://wordpress.stackexchange.com/a/42334/16898.
I replaced the variable name $posts with an arbitrary name $mposts and the error was gone.
I was having a similar error when using a WP_Query as given at
https://wordpress.stackexchange.com/a/42334/16898.
I replaced the variable name $posts with an arbitrary name $mposts and the error was gone.