Added extra  && !defined('IN_ADMIN') that was missing