wp_allowed_protocols
Retrieve a list of protocols to allow in HTML attributes.
Description
(array) wp_allowed_protocols();
Returns (array)
Array of allowed protocols. Defaults to an array containing 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal', and 'urn'.
Usage
if ( !function_exists( 'wp_allowed_protocols' ) ) { require_once ABSPATH . WPINC . '/functions.php'; } // NOTICE! Understand what this does before running. $result = wp_allowed_protocols();
Defined (1)
The function is defined in the following location(s).
- /wp-includes/functions.php
- function wp_allowed_protocols() {
- static $protocols = array();
- if ( empty( $protocols ) ) {
- $protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' );
- /**
- * Filters the list of protocols allowed in HTML attributes.
- *
- * @since 3.0.0
- *
- * @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
- */
- $protocols = apply_filters( 'kses_allowed_protocols', $protocols );
- }
- return $protocols;
- }