Error thrown

Object of class WP_Error could not be converted to string