Changeset 14450 for trunk/wp-includes/nav-menu.php
- Timestamp:
- 05/04/2010 07:40:04 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/nav-menu.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/nav-menu.php
r14404 r14450 257 257 } 258 258 259 $original_parent = 0 < $menu_item_db_id ? get_post_field( 'post_parent', $menu_item_db_id ) : 0; 260 259 261 if ( 'custom' != $args['menu-item-type'] ) { 260 262 /* if non-custom menu item, then: … … 267 269 $original_title = ''; 268 270 if ( 'taxonomy' == $args['menu-item-type'] ) { 271 $original_parent = get_term_field( 'parent', $args['menu-item-object-id'], $args['menu-item-object'], 'raw' ); 269 272 $original_title = get_term_field( 'name', $args['menu-item-object-id'], $args['menu-item-object'], 'raw' ); 270 273 } elseif ( 'post_type' == $args['menu-item-type'] ) { 271 274 272 275 $original_object = get_post( $args['menu-item-object-id'] ); 276 $original_parent = (int) $original_object->post_parent; 273 277 $original_title = $original_object->post_title; 274 278 … … 298 302 'post_content' => $args['menu-item-description'], 299 303 'post_excerpt' => $args['menu-item-attr-title'], 300 'post_parent' => $ args['menu-item-parent-id'],304 'post_parent' => $original_parent, 301 305 'post_title' => $args['menu-item-title'], 302 306 'post_type' => 'nav_menu_item', … … 327 331 328 332 update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key($args['menu-item-type']) ); 333 update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', (int) $args['menu-item-parent-id'] ); 329 334 update_post_meta( $menu_item_db_id, '_menu_item_object_id', (int) $args['menu-item-object-id'] ); 330 335 update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key($args['menu-item-object']) ); … … 440 445 * 441 446 * Properties: 442 * - db_id: The DB ID of th e this item as a nav_menu_item object, if it exists (0 if it doesn't exist).447 * - db_id: The DB ID of this item as a nav_menu_item object, if it exists (0 if it doesn't exist). 443 448 * - object_id: The DB ID of the original object this menu item represents, e.g. ID for posts and term_id for categories. 444 449 * - type: The family of objects originally represented, such as "post_type" or "taxonomy." 445 450 * - object: The type of object originally represented, such as "category," "post", or "attachment." 446 451 * - append: The singular label used to describe this type of menu item. 447 * - parent: The DB ID of the original object's parent object, if any (0 otherwise). 452 * - post_parent: The DB ID of the original object's parent object, if any (0 otherwise). 453 * - menu_item_parent: The DB ID of the nav_menu_item that is this item's menu parent, if any. 0 otherwise. 448 454 * - url: The URL to which this menu item points. 449 455 * - title: The title of this menu item. … … 463 469 if ( 'nav_menu_item' == $menu_item->post_type ) { 464 470 $menu_item->db_id = (int) $menu_item->ID; 471 $menu_item->menu_item_parent = get_post_meta( $menu_item->ID, '_menu_item_menu_item_parent', true ); 465 472 $menu_item->object_id = get_post_meta( $menu_item->ID, '_menu_item_object_id', true ); 466 473 $menu_item->object = get_post_meta( $menu_item->ID, '_menu_item_object', true ); … … 499 506 } else { 500 507 $menu_item->db_id = 0; 508 $menu_item->menu_item_parent = 0; 501 509 $menu_item->object_id = (int) $menu_item->ID; 502 510 $menu_item->type = 'post_type'; … … 518 526 $menu_item->ID = $menu_item->term_id; 519 527 $menu_item->db_id = 0; 528 $menu_item->menu_item_parent = 0; 520 529 $menu_item->object_id = (int) $menu_item->term_id; 521 530 $menu_item->post_parent = (int) $menu_item->parent;
Note: See TracChangeset
for help on using the changeset viewer.