1

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:

skype:example?call

Any thoughts on add skype: as an acceptable protocol?

Thanks.

  • Just to clarify, this is concerning the menus under apperance > menu. – addedlovely Jan 9 '12 at 22:55
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.

  • Hmm seems there is a filter, but it doesn't seem to work... apply_filters( 'kses_allowed_protocols', $protocols ) found that digging around wp_allowed_protocols() – addedlovely Jan 10 '12 at 1:37
1

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' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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