Changeset 58119
- Timestamp:
- 05/08/2024 06:35:10 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/nav-menu.php
r56192 r58119 281 281 $locations = get_nav_menu_locations(); 282 282 foreach ( $locations as $location => $menu_id ) { 283 if ( $menu_id == $menu->term_id ) {283 if ( $menu_id === $menu->term_id ) { 284 284 $locations[ $location ] = 0; 285 285 } … … 332 332 ! is_wp_error( $_possible_existing ) && 333 333 isset( $_possible_existing->term_id ) && 334 $_possible_existing->term_id != $menu_id334 $_possible_existing->term_id !== $menu_id 335 335 ) { 336 336 return new WP_Error( … … 459 459 $args = wp_parse_args( $menu_item_data, $defaults ); 460 460 461 if ( 0 == $menu_id ) {461 if ( 0 === $menu_id ) { 462 462 $args['menu-item-position'] = 1; 463 } elseif ( 0 == (int) $args['menu-item-position'] ) { 464 $menu_items = 0 == $menu_id ? array() : (array) wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) ); 465 $last_item = array_pop( $menu_items ); 466 $args['menu-item-position'] = ( $last_item && isset( $last_item->menu_order ) ) ? 1 + $last_item->menu_order : count( $menu_items ); 463 } elseif ( 0 === (int) $args['menu-item-position'] ) { 464 $menu_items = array(); 465 466 if ( 0 !== $menu_id ) { 467 $menu_items = (array) wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) ); 468 } 469 470 $last_item = array_pop( $menu_items ); 471 472 if ( $last_item && isset( $last_item->menu_order ) ) { 473 $args['menu-item-position'] = 1 + $last_item->menu_order; 474 } else { 475 $args['menu-item-position'] = count( $menu_items ); 476 } 467 477 } 468 478 … … 523 533 } 524 534 525 $update = 0 != $menu_item_db_id;535 $update = 0 !== $menu_item_db_id; 526 536 527 537 // New menu item. Default is draft status. … … 583 593 update_post_meta( $menu_item_db_id, '_menu_item_url', sanitize_url( $args['menu-item-url'] ) ); 584 594 585 if ( 0 == $menu_id ) {595 if ( 0 === $menu_id ) { 586 596 update_post_meta( $menu_item_db_id, '_menu_item_orphaned', (string) time() ); 587 597 } elseif ( get_post_meta( $menu_item_db_id, '_menu_item_orphaned' ) ) { … … 1060 1070 'taxonomy' === $object_type && 1061 1071 'taxonomy' === $menu_item_type && 1062 get_post_meta( $menu_item->ID, '_menu_item_object', true ) == $taxonomy1072 get_post_meta( $menu_item->ID, '_menu_item_object', true ) === $taxonomy 1063 1073 ) { 1064 1074 $menu_item_ids[] = (int) $menu_item->ID; … … 1147 1157 } 1148 1158 foreach ( $items as $item ) { 1149 if ( $post->ID == $item->object_id ) {1159 if ( $post->ID === (int) $item->object_id ) { 1150 1160 continue 2; 1151 1161 }
Note: See TracChangeset
for help on using the changeset viewer.