diff --git a/src/wp-includes/category.php b/src/wp-includes/category.php
index cbef474..a89b410 100644
|
a
|
b
|
function get_categories( $args = '' ) { |
| 51 | 51 | $taxonomy = $args['taxonomy'] = 'link_category'; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | | $categories = (array) get_terms( $taxonomy, $args ); |
| | 54 | $categories = get_terms( $taxonomy, $args ); |
| 55 | 55 | |
| 56 | | foreach ( array_keys( $categories ) as $k ) |
| 57 | | _make_cat_compat( $categories[$k] ); |
| | 56 | if ( is_wp_error( $categories ) ) { |
| | 57 | $categories = array(); |
| | 58 | } else { |
| | 59 | $categories = (array) $categories; |
| | 60 | foreach ( array_keys( $categories ) as $k ) { |
| | 61 | _make_cat_compat( $categories[ $k ] ); |
| | 62 | } |
| | 63 | } |
| 58 | 64 | |
| 59 | 65 | return $categories; |
| 60 | 66 | } |
diff --git a/tests/phpunit/tests/category/getCategories.php b/tests/phpunit/tests/category/getCategories.php
new file mode 100644
index 0000000..3f2140d
|
-
|
+
|
|
| | 1 | <?php |
| | 2 | |
| | 3 | /** |
| | 4 | * @group taxonomy |
| | 5 | * @group category.php |
| | 6 | */ |
| | 7 | class Tests_Category_GetCategories extends WP_UnitTestCase { |
| | 8 | /** |
| | 9 | * @ticket 36227 |
| | 10 | */ |
| | 11 | public function test_wp_error_should_return_an_empty_array() { |
| | 12 | $found = get_categories( array( 'taxonomy' => 'foo' ) ); |
| | 13 | $this->assertSame( array(), $found ); |
| | 14 | } |
| | 15 | } |