diff --git wp-includes/default-filters.php wp-includes/default-filters.php
index c796453..4121af3 100644
|
|
add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' ); |
248 | 248 | add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' ); |
249 | 249 | |
250 | 250 | // Navigation menu actions |
251 | | add_action( 'delete_post', '_wp_delete_post_menu_item' ); |
252 | | add_action( 'delete_term', '_wp_delete_tax_menu_item' ); |
253 | | add_action( 'transition_post_status', '_wp_auto_add_pages_to_menu', 10, 3 ); |
| 251 | add_action( 'delete_post', '_wp_delete_post_menu_item' ); |
| 252 | add_action( 'delete_term', '_wp_delete_tax_menu_item', 10, 3 ); |
| 253 | add_action( 'transition_post_status', '_wp_auto_add_pages_to_menu', 10, 3 ); |
254 | 254 | |
255 | 255 | // Post Thumbnail CSS class filtering |
256 | 256 | add_action( 'begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add' ); |
diff --git wp-includes/nav-menu.php wp-includes/nav-menu.php
index e1af8f7..1a30131 100644
|
|
function wp_setup_nav_menu_item( $menu_item ) { |
640 | 640 | * |
641 | 641 | * @param int $object_id The ID of the original object. |
642 | 642 | * @param string $object_type The type of object, such as "taxonomy" or "post_type." |
| 643 | * @param string $taxonomy If $object_type is "taxonomy", $taxonomy is the name of the tax that $object_id belongs to |
643 | 644 | * @return array The array of menu item IDs; empty array if none; |
644 | 645 | */ |
645 | | function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_type' ) { |
| 646 | function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_type', $taxonomy = '' ) { |
646 | 647 | $object_id = (int) $object_id; |
647 | 648 | $menu_item_ids = array(); |
648 | 649 | |
… |
… |
function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_ |
658 | 659 | ); |
659 | 660 | foreach( (array) $menu_items as $menu_item ) { |
660 | 661 | if ( isset( $menu_item->ID ) && is_nav_menu_item( $menu_item->ID ) ) { |
661 | | if ( get_post_meta( $menu_item->ID, '_menu_item_type', true ) != $object_type ) |
| 662 | if ( get_post_meta( $menu_item->ID, '_menu_item_type', true ) != $object_type || get_post_meta( $menu_item->ID, '_menu_item_object', true ) != $taxonomy ) |
662 | 663 | continue; |
663 | 664 | |
664 | 665 | $menu_item_ids[] = (int) $menu_item->ID; |
… |
… |
function _wp_delete_post_menu_item( $object_id = 0 ) { |
696 | 697 | * @param int $object_id The ID of the original object being trashed. |
697 | 698 | * |
698 | 699 | */ |
699 | | function _wp_delete_tax_menu_item( $object_id = 0 ) { |
| 700 | function _wp_delete_tax_menu_item( $object_id = 0, $tt_id, $taxonomy ) { |
700 | 701 | $object_id = (int) $object_id; |
701 | 702 | |
702 | | $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'taxonomy' ); |
| 703 | $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'taxonomy', $taxonomy ); |
703 | 704 | |
704 | 705 | foreach( (array) $menu_item_ids as $menu_item_id ) { |
705 | 706 | wp_delete_post( $menu_item_id, true ); |