Ticket #15264: 15264.diff
File 15264.diff, 2.7 KB (added by , 12 years ago) |
---|
-
wp-includes/default-filters.php
260 260 add_action( 'welcome_panel', 'wp_welcome_panel' ); 261 261 262 262 // Navigation menu actions 263 add_action( 'delete_post', '_wp_delete_post_menu_item' 264 add_action( 'delete_term', '_wp_delete_tax_menu_item' 265 add_action( 'transition_post_status', '_wp_auto_add_pages_to_menu', 10, 3 263 add_action( 'delete_post', '_wp_delete_post_menu_item' ); 264 add_action( 'delete_term', '_wp_delete_tax_menu_item', 10, 3 ); 265 add_action( 'transition_post_status', '_wp_auto_add_pages_to_menu', 10, 3 ); 266 266 267 267 // Post Thumbnail CSS class filtering 268 268 add_action( 'begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add' ); -
wp-includes/nav-menu.php
674 674 * 675 675 * @param int $object_id The ID of the original object. 676 676 * @param string $object_type The type of object, such as "taxonomy" or "post_type." 677 * @param string $taxonomy If $object_type is "taxonomy", $taxonomy is the name of the tax that $object_id belongs to 677 678 * @return array The array of menu item IDs; empty array if none; 678 679 */ 679 function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_type' ) {680 function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_type', $taxonomy = '' ) { 680 681 $object_id = (int) $object_id; 681 682 $menu_item_ids = array(); 682 683 … … 692 693 ); 693 694 foreach( (array) $menu_items as $menu_item ) { 694 695 if ( isset( $menu_item->ID ) && is_nav_menu_item( $menu_item->ID ) ) { 695 if ( get_post_meta( $menu_item->ID, '_menu_item_type', true ) != $object_type ) 696 if ( get_post_meta( $menu_item->ID, '_menu_item_type', true ) !== $object_type || 697 get_post_meta( $menu_item->ID, '_menu_item_object', true ) !== $taxonomy ) 696 698 continue; 697 699 698 700 $menu_item_ids[] = (int) $menu_item->ID; … … 730 732 * @param int $object_id The ID of the original object being trashed. 731 733 * 732 734 */ 733 function _wp_delete_tax_menu_item( $object_id = 0 ) {735 function _wp_delete_tax_menu_item( $object_id = 0, $tt_id, $taxonomy ) { 734 736 $object_id = (int) $object_id; 735 737 736 $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'taxonomy' );738 $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'taxonomy', $taxonomy ); 737 739 738 740 foreach( (array) $menu_item_ids as $menu_item_id ) { 739 741 wp_delete_post( $menu_item_id, true );