Built-in data validation function for URLs
Use esc_url( $url ) for URLs that should be displayed and esc_url_raw( $url ) if the URL should be sent to the database. The first will replace bare ampersands & with &. The second is a wrapper for the first; it will just suppress the escaping of ampersands. Both functions will check the protocol. See … Read more