wp_nav_menu including Skype URL

If I try to add a skype username as the URL for a wp_nav_menu item, the item is saved but the URL is not.

The username URL is in the following format:

Read More

skype:example?call

Any thoughts on add skype: as an acceptable protocol?

Thanks.

Related posts

Leave a Reply

2 comments

  1. I believe the esc_url function is what ultimately filters the url you enter in that field. Unfortunately, I don’t see how you could allow the skype protocol without manually editing that function in the core file wp-includes/formatting.php, which is always a bad idea.

    if ( !is_array($protocols) )
        $protocols = array ('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn');
    if ( wp_kses_bad_protocol( $url, $protocols ) != $url )
        return '';
    

    Perhaps I’ve missed something though.

  2. You can make the skype: as an acceptable protocol by adding the following code in the functions.php file of your child theme or develop a small plugin and add it in that plugin file.

    /**
     * Allows users to save skype protocol skype: in menu URL
     */
    function vvd_allow_skype_protocol( $protocols ){
        $protocols[] = 'skype';
        return $protocols;
    }
    add_filter( 'kses_allowed_protocols' , 'vvd_allow_skype_protocol' );