Ticket #13822: 13822.diff
File 13822.diff, 1.6 KB (added by , 15 years ago) |
---|
-
wp-includes/nav-menu.php
471 471 $fetched[$menu->term_id] = true; 472 472 $posts = array(); 473 473 $terms = array(); 474 foreach ( $items as $ item ) {474 foreach ( $items as $key => $item ) { 475 475 $object_id = get_post_meta( $item->ID, '_menu_item_object_id', true ); 476 476 $object = get_post_meta( $item->ID, '_menu_item_object', true ); 477 477 $type = get_post_meta( $item->ID, '_menu_item_type', true ); 478 478 479 if ( 'post_type' == $type ) 479 if ( 'post_type' == $type ) { 480 480 $posts[$object][] = $object_id; 481 elseif ( 'taxonomy' == $type) 481 $items[$key]->post_object_id = $object_id; 482 } elseif ( 'taxonomy' == $type) 482 483 $terms[$object][] = $object_id; 484 485 $items[$key]->object_type = $object; 483 486 } 484 487 485 488 if ( ! empty( $posts ) ) { 486 489 foreach ( array_keys($posts) as $post_type ) { 487 get_posts( array('post__in' => $posts[$post_type], 'post_type' => $post_type, 'nopaging' => true, 'update_post_term_cache' => false) ); 490 $_posts = get_posts( array('post__in' => $posts[$post_type], 'post_type' => $post_type, 'nopaging' => true, 'update_post_term_cache' => false, 'post_status' => 'publish' ) ); 491 foreach ( $items as $key => $item ) { 492 if ( $item->object_type == $post_type ) { 493 $found = false; 494 foreach ( $_posts as $p ) { 495 if ( $p->ID == $item->post_object_id ) { 496 $found = true; 497 break; 498 } 499 } 500 if ( !$found ) 501 unset( $items[$key] ); 502 } 503 } 488 504 } 489 505 } 490 506 unset($posts);