Refactored way to check wordpress 404 status code