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

  1. if ( !function_exists( 'wp_allowed_protocols' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_allowed_protocols(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/functions.php  
  1. function wp_allowed_protocols() { 
  2. static $protocols = array(); 
  3.  
  4. if ( empty( $protocols ) ) { 
  5. $protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' ); 
  6.  
  7. /** 
  8. * Filters the list of protocols allowed in HTML attributes. 
  9. * @since 3.0.0 
  10. * @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more. 
  11. */ 
  12. $protocols = apply_filters( 'kses_allowed_protocols', $protocols ); 
  13.  
  14. return $protocols;