1

Topic: Using htmLawed in WordPress 2

WordPress can be made to use htmLawed instead of Kses as htmLawed code is compatible with code calling the kses() function. Following steps are suggested (also see htmLawed doc):

1. Copy the htmLawed code to file wp_includes/kses.php,

2. Rename the newly added function kses to wp_kses, and delete the code for the original wp_kses function.

3. Enter following code in function kses_hook:

$allowed_html = $spec;
$allowed_protocols = array();
foreach($cf['schemes'] as $v){
 foreach($v as $k2=>$v2){
  if(!in_array($k2, $allowed_protocols)){
   $allowed_protocols[] = $k2;
  }
 }
}
return wp_kses_hook($string, $allowed_html, $allowed_protocols);