upgrading the javascript to be wp 4.x compliant