Ticket #24354: 24354.2.diff
File 24354.2.diff, 1.0 KB (added by , 11 years ago) |
---|
-
tests/phpunit/tests/taxonomy.php
234 234 ); 235 235 $this->assertEquals( 0, wp_insert_category( $cat, false ) ); 236 236 } 237 238 /** 239 * @ticket 24354 240 */ 241 function test_cat_has_ampersand() { 242 $name = 'News & Press'; 243 $expected = wp_create_category( $name ); 244 $this->assertEquals( $expected, get_cat_id( $name ) ); 245 } 237 246 } -
src/wp-includes/category.php
168 168 * @return int 0, if failure and ID of category on success. 169 169 */ 170 170 function get_cat_ID( $cat_name ) { 171 $cat_name = _wp_specialchars( $cat_name ); // get_term_by expects $cat_name to be escaped 171 172 $cat = get_term_by( 'name', $cat_name, 'category' ); 172 173 if ( $cat ) 173 174 return $cat->term_id;