Ticket #28140: 28140.diff
File 28140.diff, 1.4 KB (added by , 10 years ago) |
---|
-
src/wp-includes/nav-menu.php
331 331 'menu-item-object-id' => 0, 332 332 'menu-item-object' => '', 333 333 'menu-item-parent-id' => 0, 334 'menu-item-position' => 0,334 'menu-item-position' => 1, 335 335 'menu-item-type' => 'custom', 336 336 'menu-item-title' => '', 337 337 'menu-item-url' => '', … … 345 345 346 346 $args = wp_parse_args( $menu_item_data, $defaults ); 347 347 348 if ( 0 == $menu_id ) { 349 $args['menu-item-position'] = 1; 350 } elseif ( 0 == (int) $args['menu-item-position'] ) { 351 $menu_items = 0 == $menu_id ? array() : (array) wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) ); 348 if ( 0 != $menu_id && 0 == (int) $args['menu-item-position'] ) { 349 $menu_items = (array) wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) ); 352 350 $last_item = array_pop( $menu_items ); 353 $args['menu-item-position'] = ( $last_item && isset( $last_item->menu_order ) ) ? 1 + $last_item->menu_order : count( $menu_items ); 351 if ( $last_item && isset( $last_item->menu_order ) ) { 352 $args['menu-item-position'] = 1 + $last_item->menu_order; 353 } elseif ( count( $menu_items ) ) { 354 $args['menu-item-position'] = count( $menu_items ); 355 } 354 356 } 355 357 356 358 $original_parent = 0 < $menu_item_db_id ? get_post_field( 'post_parent', $menu_item_db_id ) : 0;