Error thrown

Cannot use object of type WP_Post as array