Canonicalizes a string to a URL-friendly format. Based on a combination of WordPress functions.