Extending Allowed URL Protocols

For security and proper URL formatting, we use the standard WordPress function esc_url in multiple areas on Themify themes.

This function has a peculiarity: it will only allow certain known and safe protocols. By default in WordPress it will only allow these protocols:

http, https, ftp, ftps, mailto, news, irc, gopher, nntp, feed, telnet, mms, rtsp, svn, tel, fax, xmpp

In Themify themes and Builder, we have also added:

skype, sms, comgooglemaps, comgooglemapsurl, comgooglemaps-x-callback

But perhaps you need even another protocol. You can add your own protocol following these steps:

1. create a file named custom-functions.php in the theme root

2. edit it and paste this in it:

<?php
/**
 * Add extra protocols to list of allowed protocols.
 *
 * @param array $protocols List of protocols allowed by default by WordPress.
 *
 * @return array $protocols Updated list including extra protocols added.
 */
function custom_themify_add_more_protocols( $protocols ){
	$protocols[] = 'andromo';
	return $protocols;
}
add_filter( 'kses_allowed_protocols' , 'custom_themify_add_more_protocols' );

3. save the file. If you were editing it locally, upload it by FTP to the theme folder in your server.