wp_allowed_protocols() WP 3.3.0
Retrieve a list of protocols to allow in HTML attributes.
Хуки из функции
Возвращает
Строку[]. Array of allowed protocols. This covers all common link protocols, except for 'javascript' which should not be allowed for untrusted users.
Использование
wp_allowed_protocols();
Заметки
- Смотрите: wp_kses()
- Смотрите: esc_url()
Список изменений
С версии 3.3.0 | Введена. |
С версии 4.3.0 | Added 'webcal' to the protocols array. |
С версии 4.7.0 | Added 'urn' to the protocols array. |
С версии 5.3.0 | Added 'sms' to the protocols array. |
С версии 5.6.0 | Added 'irc6' and 'ircs' to the protocols array. |
Код wp_allowed_protocols() wp allowed protocols WP 5.6
function wp_allowed_protocols() {
static $protocols = array();
if ( empty( $protocols ) ) {
$protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'irc6', 'ircs', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' );
}
if ( ! did_action( 'wp_loaded' ) ) {
/**
* Filters the list of protocols allowed in HTML attributes.
*
* @since 3.0.0
*
* @param string[] $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
*/
$protocols = array_unique( (array) apply_filters( 'kses_allowed_protocols', $protocols ) );
}
return $protocols;
}