[wp-trac] [WordPress Trac] #17067: Appearance > Menus removing custom class underscore ("_")
WordPress Trac
wp-trac at lists.automattic.com
Wed Apr 6 22:11:31 UTC 2011
#17067: Appearance > Menus removing custom class underscore ("_")
--------------------------+---------------------
Reporter: swartsr | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 3.2
Component: Menus | Version: 3.1
Severity: normal | Resolution: fixed
Keywords: |
--------------------------+---------------------
Comment (by swartsr):
This filter should fix it! The issue seems to be in the formatting.php
file. Just a simple matter of leaving the "_" out of the accepted
characters. Thanks!
{{{
function my_sanitize_html_class( $class, $fallback = '' ) {
//Strip out any % encoded octets
$sanitized = preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '',
$class);
//Limit to A-Z,a-z,0-9,'-' '_'
$sanitized = preg_replace('/[^A-Za-z0-9-_]/', '', $sanitized);
if ( '' == $sanitized )
$sanitized = $fallback;
return apply_filters( 'sanitize_html_class', $sanitized, $class,
$fallback );
}
add_filter('sanitize_html_class','my_sanitize_html_class');
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17067#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list