Ticket #23636: 23636.2.patch
| File 23636.2.patch, 1.8 KB (added by , 11 years ago) |
|---|
-
src/wp-includes/taxonomy.php
1804 1804 } 1805 1805 1806 1806 if ( ! empty( $args['slug'] ) ) { 1807 $slug = sanitize_title( $args['slug'] ); 1808 $where .= " AND t.slug = '$slug'"; 1807 if ( is_array( $args['slug'] ) ) { 1808 $slug = array_map( 'sanitize_title', $args['slug'] ); 1809 $where .= " AND t.slug IN ('" . implode( "', '", $slug ) . "')"; 1810 } else { 1811 $slug = sanitize_title( $args['slug'] ); 1812 $where .= " AND t.slug = '$slug'"; 1813 } 1809 1814 } 1810 1815 1811 1816 if ( ! empty( $args['name__like'] ) ) { -
tests/phpunit/tests/term/getTerms.php
352 352 add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 ); 353 353 } 354 354 355 function test_get_terms_by_slug() { 356 $foo = $this->factory->tag->create( array( 'slug' => 'foo' ) ); 357 358 $found = get_terms( 'post_tag', array( 359 'hide_empty' => false, 360 'fields' => 'ids', 361 'slug' => 'foo', 362 ) ); 363 364 $this->assertEquals( array( $foo ), $found ); 365 } 366 367 function test_get_terms_by_multiple_slugs() { 368 $foo = $this->factory->tag->create( array( 'slug' => 'foo' ) ); 369 $bar = $this->factory->tag->create( array( 'slug' => 'bar' ) ); 370 371 $found = get_terms( 'post_tag', array( 372 'hide_empty' => false, 373 'fields' => 'ids', 374 'slug' => array( 'foo', 'bar' ) 375 ) ); 376 377 $this->assertEquals( array( $foo, $bar ), $found ); 378 } 379 355 380 public function test_get_terms_hierarchical_tax_hide_empty_false_fields_ids() { 356 381 // Set up a clean taxonomy. 357 382 $tax = 'hierarchical_fields';