Retrieves a list of protocols to allow in HTML attributes.
Return
string[]
Array of allowed protocols. Defaults to an array containing 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'irc6', 'ircs', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', and 'urn'. This covers all common link protocols, except for 'javascript' which should not be allowed for untrusted users.
Hooks fired · 1
One hook fires while wp_allowed_protocols() runs, in this order:
7203functionwp_allowed_protocols(){7204static$protocols=array();72057206if(empty($protocols)){7207$protocols=array('http','https','ftp','ftps','mailto','news','irc','irc6','ircs','gopher','nntp','feed','telnet','mms','rtsp','sms','svn','tel','fax','xmpp','webcal','urn');7208}72097210if(!did_action('wp_loaded')){7211/**7212 * Filters the list of protocols allowed in HTML attributes.7213 *7214 * @since 3.0.07215 *7216 * @param string[] $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.7217 */7218$protocols=array_unique((array)apply_filters('kses_allowed_protocols',$protocols));7219}72207221return$protocols;7222}
History
Introduced in 3.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
5.6.0
Added 'irc6' and 'ircs' to the protocols array.from the docblock
5.3.0
Added 'sms' to the protocols array.from the docblock
4.7.0
Added 'urn' to the protocols array.from the docblock
4.3.0
Added 'webcal' to the protocols array.from the docblock
3.3.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.