Ticket #24354: 24354.3.diff
File 24354.3.diff, 1.1 KB (added by , 8 years ago) |
---|
-
src/wp-includes/category-functions.php
171 171 * @return int 0, if failure and ID of category on success. 172 172 */ 173 173 function get_cat_ID( $cat_name ) { 174 $cat_name = _wp_specialchars( $cat_name ); // get_term_by expects $cat_name to be escaped 174 175 $cat = get_term_by( 'name', $cat_name, 'category' ); 175 if ( $cat ) 176 if ( $cat ) { 176 177 return $cat->term_id; 178 } 177 179 return 0; 178 180 } 179 181 -
tests/phpunit/tests/taxonomy.php
482 482 483 483 $this->assertFalse( is_tax( 'wptests_tax' ) ); 484 484 } 485 486 /** 487 * @ticket 24354 488 */ 489 function test_cat_has_ampersand() { 490 $name = 'News & Press'; 491 $expected = wp_create_category( $name ); 492 $this->assertEquals( $expected, get_cat_id( $name ) ); 493 } 485 494 }