WARNING: This page is about a different car, the 2017 Hyundai Sonata and 2016 Hyundai Sonata. However, it is still accessible from the selected car via links, so may be relevant.
Check for continuity between the tailgate latch terminals.
Fig 1: Checking Continuity Between Tailgate Latch Terminals
Courtesy of HYUNDAI MOTOR AMERICA
If continuity is not specified, inspect the switch