Title: kses_allowed_protocols
Published: April 25, 2014
Last modified: May 20, 2026

---

# apply_filters( ‘kses_allowed_protocols’, string[] $protocols )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#wp--skip-link--target)

Filters the list of protocols allowed in HTML attributes.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#parameters)󠁿

 `$protocols`string[]

Array of allowed protocols e.g. `'http'`, `'ftp'`, `'tel'`, and more.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#source)󠁿

    ```php
    $protocols = array_unique( (array) apply_filters( 'kses_allowed_protocols', $protocols ) );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/functions.php#L7256)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/functions.php#L7256-L7256)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_allowed_protocols()](https://developer.wordpress.org/reference/functions/wp_allowed_protocols/)`wp-includes/functions.php` |

Retrieves a list of protocols to allow in HTML attributes.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 4 content](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#comment-content-2321)
 2.    [Mayo Moriyama](https://profiles.wordpress.org/mayukojpn/)  [  9 years ago  ](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/#comment-2321)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fkses_allowed_protocols%2F%23comment-2321)
     Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fkses_allowed_protocols%2F%23comment-2321)
 4.  Allow Skype call links.
 5.      ```php
         add_filter( 'kses_allowed_protocols', function ( $protocols ) {
             $protocols[] = 'skype';
             return $protocols;
         } );
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fkses_allowed_protocols%2F%3Freplytocom%3D2321%23feedback-editor-2321)
 7.   [Skip to note 5 content](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#comment-content-7404)
 8.    [Andrew Lima](https://profiles.wordpress.org/andrewza/)  [  7 months ago  ](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/#comment-7404)
 9.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fkses_allowed_protocols%2F%23comment-7404)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fkses_allowed_protocols%2F%23comment-7404)
 10. Currently wp_kses_post will filter a URL that uses `[somelink](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/void(0);?output_format=md)`.
 11. Here’s how you can allow it:
 12. `
      add_filter( ‘kses_allowed_protocols’, function( $protocols ) { $protocols[]
     = ‘javascript’; return $protocols; } ); `
 13.  * `add_filter( ‘kses_allowed_protocols’, function( $protocols ) { $protocols[]
        = ‘javascript’; return $protocols; } );`
      * [Andrew Lima](https://profiles.wordpress.org/andrewza/) [7 months ago](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/#comment-7405)
      * Nah bro IDK how to get a code block like other commenters, didn’t have the 
        option.
      * [Andrew Lima](https://profiles.wordpress.org/andrewza/) [7 months ago](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/#comment-7406)
 14.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fkses_allowed_protocols%2F%3Freplytocom%3D7404%23feedback-editor-7404)
 15.  [Skip to note 6 content](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/?output_format=md#comment-content-149)
 16.   [hatul](https://profiles.wordpress.org/hatul/)  [  12 years ago  ](https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/#comment-149)
 17. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fkses_allowed_protocols%2F%23comment-149)
     Vote results for this note: -1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fkses_allowed_protocols%2F%23comment-149)
 18. The filter should to run before init.
 19. _Note: this example only works in PHP 5.3+_
 20.     ```php
         function wpse_allow_sms_protocol( $protocols ) {
             $protocols[] = 'sms';
             return $protocols;
         }
         add_action('plugins_loaded', function(){add_filter('kses_allowed_protocols', 'wpse_allow_sms_protocol' );});
         print_r(wp_allowed_protocols());
         ```
     
 21.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fkses_allowed_protocols%2F%3Freplytocom%3D149%23feedback-editor-149)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fkses_allowed_protocols%2F)
before being able to contribute a note or feedback.