1 | Index: src/wp-includes/nav-menu.php |
---|
2 | =================================================================== |
---|
3 | --- src/wp-includes/nav-menu.php (revision 36513) |
---|
4 | +++ src/wp-includes/nav-menu.php (working copy) |
---|
5 | @@ -758,7 +758,9 @@ |
---|
6 | } |
---|
7 | |
---|
8 | $menu_item->type_label = __( 'Post Type Archive' ); |
---|
9 | - $menu_item->description = ''; |
---|
10 | $menu_item->url = get_post_type_archive_link( $menu_item->object ); |
---|
11 | } elseif ( 'taxonomy' == $menu_item->type ) { |
---|
12 | $object = get_taxonomy( $menu_item->object ); |
---|
13 | Index: tests/phpunit/tests/post/nav-menu.php |
---|
14 | =================================================================== |
---|
15 | --- tests/phpunit/tests/post/nav-menu.php (revision 36513) |
---|
16 | +++ tests/phpunit/tests/post/nav-menu.php (working copy) |
---|
17 | @@ -180,4 +180,38 @@ |
---|
18 | |
---|
19 | $this->assertEquals( $nav_menus_names, $expected_nav_menus_names ); |
---|
20 | } |
---|
21 | + |
---|
22 | + /** |
---|
23 | + * @ticket 35324 |
---|
24 | + */ |
---|
25 | + function test_wp_setup_nav_menu_item_for_post_type_archive() { |
---|
26 | + |
---|
27 | + $post_type_slug = rand_str( 12 ); |
---|
28 | + $post_type_description = rand_str(); |
---|
29 | + register_post_type( $post_type_slug ,array( |
---|
30 | + 'public' => true, |
---|
31 | + 'has_archive' => true, |
---|
32 | + 'description' => $post_type_description, |
---|
33 | + 'label' => $post_type_slug |
---|
34 | + )); |
---|
35 | + |
---|
36 | + $post_type_archive_item_id = wp_update_nav_menu_item( $this->menu_id, 0, array( |
---|
37 | + 'menu-item-type' => 'post_type_archive', |
---|
38 | + 'menu-item-object' => $post_type_slug, |
---|
39 | + 'menu-item-status' => 'publish' |
---|
40 | + ) ); |
---|
41 | + $post_type_archive_item = wp_setup_nav_menu_item( get_post( $post_type_archive_item_id ) ); |
---|
42 | + |
---|
43 | + $this->assertEquals( $post_type_slug , $post_type_archive_item->title ); |
---|
44 | + $this->assertEquals( $post_type_description , $post_type_archive_item->description ); //fail!!! |
---|
45 | + |
---|
46 | + } |
---|
47 | } |
---|