Ticket #35324: 35324.7.diff
File 35324.7.diff, 2.0 KB (added by , 9 years ago) |
---|
-
src/wp-includes/nav-menu.php
762 762 $object = get_post_type_object( $menu_item->object ); 763 763 if ( $object ) { 764 764 $menu_item->title = '' == $menu_item->post_title ? $object->labels->archives : $menu_item->post_title; 765 $post_type_description = $object->description; 765 766 } else { 766 767 $menu_item->_invalid = true; 768 $post_type_description = ''; 767 769 } 768 770 769 771 $menu_item->type_label = __( 'Post Type Archive' ); 770 772 $post_content = wp_trim_words( $menu_item->post_content, 200 ); 771 $post_type_description = '' == $post_content ? $ object->description : $post_content;773 $post_type_description = '' == $post_content ? $post_type_description : $post_content; 772 774 $menu_item->url = get_post_type_archive_link( $menu_item->object ); 773 775 } elseif ( 'taxonomy' == $menu_item->type ) { 774 776 $object = get_taxonomy( $menu_item->object ); -
tests/phpunit/tests/post/nav-menu.php
258 258 $this->assertEquals( $post_type_slug , $post_type_archive_item->title ); 259 259 $this->assertEquals( $menu_item_description , $post_type_archive_item->description ); 260 260 } 261 262 /** 263 * @ticket 35324 264 */ 265 function test_wp_setup_nav_menu_item_for_unknown_post_type_archive_no_description() { 266 267 $post_type_slug = rand_str( 12 ); 268 269 $post_type_archive_item_id = wp_update_nav_menu_item( $this->menu_id, 0, array( 270 'menu-item-type' => 'post_type_archive', 271 'menu-item-object' => $post_type_slug, 272 'menu-item-status' => 'publish' 273 ) ); 274 $post_type_archive_item = wp_setup_nav_menu_item( get_post( $post_type_archive_item_id ) ); 275 276 $this->assertEmpty( $post_type_archive_item->description ); 277 } 261 278 }