I’m using esc_url to sanitize my url. The only problem is that “my link” becomes “mylink”. I wouldreally like it to become “my-link”.
Is there a way to change this?
I’m using esc_url to sanitize my url. The only problem is that “my link” becomes “mylink”. I wouldreally like it to become “my-link”.
Is there a way to change this?
$url = esc_url ( str_replace(' ' , '-', $url ) );
Replace the spaces to – chars before activating esc_url function, and your problem is solved.