Fix JavaScript error when wp is not defined

Signed-off-by: Elliot Condon <e@elliotcondon.com>