enter image description here

how do I get the textbox to not add the HTTP://?

function skype_callback() {

    $options = get_option( 'theme_social_options' );

    $url = '';
    if ( isset( $options['skype'] ) ) {
        $url = esc_url( $options['skype'] );
    } // end if

    echo '<input type="text" id="skype" name="theme_social_options[skype]" value="' . $url . '" />';

} // end skype_callback

1 Answer 1


The escaping function is adding it, esc_url guarantees that what it returns will be a URL, as it's an escaping function, and so it should, if you're outputting a URL you should use esc_url so that it's safe and definitely a URL and not something else maliciously snuck in.

The confusion here though, is that things are getting muddled up. The textbox is not supposed to contain a Skype username, it's meant to contain a Skype URL.

A skype url when clicked on, opens the Skype app, and starts a call with you. I believe they look like this: skype:username?chat

Think of it another way. If the theme presents just a skype icon, and you enter a skype username into the box, what happens when you click the skype icon?

Suffice to say, you will need to do multiple things to change it from a skype URL to a skype username:

  • Replace esc_url with esc_attr
  • Re-implement the frontend code to display a skype username rather than a clickable skype URL link, and that it uses esc_html not esc_url
  • Look up the saving code to make sure it sanitises as a HTML string, not a URL

Note that all of these changes will be lost if you ever update the theme. You're not supposed to directly modify themes as you're doing, but create child themes instead

  • This Stack Overflow question gives more information about the kinds of action links you can create, e.g. calling, viewing profile, voicemails, etc stackoverflow.com/questions/16177332/…
    – Tom J Nowell
    Commented Sep 17, 2018 at 20:46
  • No, I can't get any of that to work. This is my own theme don't have to worry about it being lost.
    – bckelley
    Commented Sep 17, 2018 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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