[wp-trac] [WordPress Trac] #17067: Appearance > Menus removing custom class underscore ("_")

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 6 22:14:04 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 nacin):

 You'll want to remove `return apply_filters( 'sanitize_html_class',
 $sanitized, $class, $fallback );`, otherwise you'll create an indefinite
 loop.

 So change that to `return $sanitized;`

 Also, you need to check out the order in which things are passed. The
 filter passes $sanitized, then $class, then $fallback. So:

 `function my_sanitize_html_class( $class, $fallback = '' ) {`

 Needs to be:

 `function my_sanitize_html_class( $sanitize, $class, $fallback ) {`

 Additionally, you need all three arguments, so:

 `add_filter( 'sanitize_html_class', 'my_sanitize_html_class', 10, 3 );

 Note that 10 is priority. 10 is default.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17067#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list