WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted
$url = esc_url ( str_replace(' ' , '-', $url ) );

Replace the spaces to - chars before activating esc_url function, and your problem is solved.

share|improve this answer
    
I know - I was hoping that esc_url had a function so I didn't have to use str_replace. Thanks for your answer. – Steven Apr 7 '11 at 21:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.