WordPress.org

Make WordPress Core

Ticket #30421: aria-kses-2.diff

File aria-kses-2.diff, 548 bytes (added by mattheu, 4 years ago)

Simpler - permit any aria-* attributes

  • src/wp-includes/kses.php

    diff --git a/src/wp-includes/kses.php b/src/wp-includes/kses.php
    index ba96b08..82e22f3 100644
    a b function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) { 
    788788                } // if !is_array($current)
    789789        } // foreach
    790790
     791        // Allow attr-* attributes.
     792        foreach ( $attrarr as $attr ) {
     793                if ( 0 === strpos( $attr['name'], 'aria-' ) ) {
     794                        $attr2 .= $arreach['whole'];
     795                }
     796        }
     797
    791798        // Remove any "<" or ">" characters
    792799        $attr2 = preg_replace('/[<>]/', '', $attr2);
    793800