[wp-trac] [WordPress Trac] #24354: get_cat_id() fails with category names containing ampersand

WordPress Trac noreply at wordpress.org
Sun Jul 28 21:33:03 UTC 2013


#24354: get_cat_id() fails with category names containing ampersand
----------------------------------------+------------------------------
 Reporter:  Kenshino                    |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Taxonomy                    |     Version:  3.5.1
 Severity:  normal                      |  Resolution:
 Keywords:  needs-testing dev-feedback  |
----------------------------------------+------------------------------

Comment (by McGuive7):

 I just tested with the following changes made to get_cat_ID() on line 172
 of category.php:

 Change from:
 `$cat = get_term_by( 'name', $cat_name, 'category' );`

 to:
 `$cat = get_term_by( 'name', esc_attr($cat_name), 'category' );`

 . . . which seems to work for both of the following:
 `echo get_cat_id('News & Media');`
 `get_cat_id('News & Media')`

 I imagine there are some major implications to changing the basic
 functionality of get_cat_ID, however. Thoughts?

 Also, this is my first post on trac - did I do it right? :)

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


More information about the wp-trac mailing list