Title: wp_kses_hook
Published: April 25, 2014
Last modified: February 24, 2026

---

# wp_kses_hook( string $content, array[]|string $allowed_html, string[] $allowed_protocols ): string

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_kses_hook/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_kses_hook/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_kses_hook/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_kses_hook/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_kses_hook/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_kses_hook/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_kses_hook/?output_format=md#changelog)

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

You add any KSES hooks here.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_kses_hook/?output_format=md#description)󠁿

There is currently only one KSES WordPress hook, [‘pre_kses’](https://developer.wordpress.org/reference/hooks/pre_kses/),
and it is called here.
All parameters are passed to the hooks and expected to receive
a string.

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

 `$content`stringrequired

Content to filter through KSES.

`$allowed_html`array[]|stringrequired

An array of allowed HTML elements and attributes, or a context name such as `'post'`.
See [wp_kses_allowed_html()](https://developer.wordpress.org/reference/functions/wp_kses_allowed_html/)
for the list of accepted context names.

`$allowed_protocols`string[]required

Array of allowed URL protocols.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_kses_hook/?output_format=md#return)󠁿

 string Filtered content through ['pre_kses'](https://developer.wordpress.org/reference/hooks/pre_kses/)
hook.

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

    ```php
    function wp_kses_hook( $content, $allowed_html, $allowed_protocols ) {
    	/**
    	 * Filters content to be run through KSES.
    	 *
    	 * @since 2.3.0
    	 *
    	 * @param string         $content           Content to filter through KSES.
    	 * @param array[]|string $allowed_html      An array of allowed HTML elements and attributes,
    	 *                                          or a context name such as 'post'. See wp_kses_allowed_html()
    	 *                                          for the list of accepted context names.
    	 * @param string[]       $allowed_protocols Array of allowed URL protocols.
    	 */
    	return apply_filters( 'pre_kses', $content, $allowed_html, $allowed_protocols );
    }
    ```

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

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_kses_hook/?output_format=md#hooks)󠁿

 [apply_filters( ‘pre_kses’, string $content, array[]|string $allowed_html, string[] $allowed_protocols )](https://developer.wordpress.org/reference/hooks/pre_kses/)

Filters content to be run through KSES.

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

| Uses | Description | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

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

Filters text content and strips out disallowed HTML.

  |

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

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

## User Contributed Notes

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