backport https://github.com/tommcfarlin/WordPress-Widget-Boilerplate/commit/d724608a3e895812767670a7408d0c17a51e56cb