[tip] Using the htmLawed HTML filter/purifier in WordPress (1 post)

  1. alpha2zee
    Posted 8 years ago #

    for those interested in replacing the Kses HTML input filter used in WordPress with htmLawed

    Following steps are suggested (also see the 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);

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 8 years ago by alpha2zee
  • This topic is not a support question
  • WordPress version: 2.5