WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/pre kses

Description

The "pre_kses" filter is used to change what types of scripts/tags are allowed in WordPress content. [1] then strips any tags/scripts/etc that are registered as not allowed.

Arguments

This filter is passed three arguments,

  • $string - Content to filter through kses
  • $allowed_html - List of allowed HTML elements
  • $allowed_protocols - Allowed protocol in links


Usage

function filter_function_name(  $string, $allowed_html, $allowed_protocols ) {
  return $string;
}
add_filter( 'pre_kses', 'filter_function_name', 10, 3 );

Related

See: Data Validation article for an in-depth discussion of input and output sanitization.

See Also